How to add docker client to Jenkins

There are times when you need to build docker images inside Jenkins. Well, actually that is a common practice nowadays. However, without setting up the docker client properly, you might now be able to do so.

When running Jenkins without docker client, you may encounter errors like this: error=2, No such file or directory
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(
	at java.base/java.lang.ProcessImpl.start(
	at java.base/java.lang.ProcessBuilder.start(
Caused: Cannot run program "docker": error=2, No such file or directory
	at java.base/java.lang.ProcessBuilder.start(
	at java.base/java.lang.ProcessBuilder.start(
	at hudson.Proc$LocalProc.<init>(
	at hudson.Proc$LocalProc.<init>(
	at hudson.Launcher$LocalLauncher.launch(
	at hudson.Launcher$ProcStarter.start(
	at hudson.Launcher$ProcStarter.join(
	at org.jenkinsci.plugins.docker.commons.impl.RegistryKeyMaterialFactory.materialize(
	at org.jenkinsci.plugins.docker.workflow.AbstractEndpointStepExecution2.doStart(
	at org.jenkinsci.plugins.workflow.steps.GeneralNonBlockingStepExecution.lambda$run$0(
	at java.base/java.util.concurrent.Executors$
	at java.base/
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/

This post’s only purpose is to help you setup a docker client correctly inside a Jenkins container so you can start building your images right away.

Just a quick note to save you time, don’t mount the docker binary from the host to the container. It doesn’t work. At least that was my experience.

You would possibly encounter errors like this:

docker: /lib/x86_64-linux-gnu/ version `GLIBC_2.32' not found (required by docker)
docker: /lib/x86_64-linux-gnu/ version `GLIBC_2.34' not found (required by docker)

Step 1: Download the Docker client

There is a dedicated page to download the Docker client. Since I’m using Jenkins lts and it’s running Debian, I can get all versions here:

Choose your version and copy the link.

Step 2: Install Docker client for Jenkins container

Now, with the link, exec into Jenkins container:

docker exec -it jenkins bash

Next, use wget to download the docker binary. If you don’t have wget installed, simply run:

apt update && apt install wget

And download the archive file:


Then extract it:

tar -xf docker-20.10.9.tgz

Now, it will extract a folder called docker. However, you just need one binary file named docker inside that folder.

The last step is to move that file to /usr/local/bin (Create this folder if it doesn’t exist)

mv ./docker/docker /usr/local/bin

Now Jenkins can build docker images without problems:

Build docker inside jenkins sucessfully


With a few very simple steps, you can now build docker images inside Jenkins.

1 thought on “How to add docker client to Jenkins”

Leave a Comment