How to add docker client to Jenkins

There are times you need to build docker images inside Jenkins. Well, actually that is a common practice nowadays. However, without setting up 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 docker client correctly inside a Jenkins container so you can start building your images right away.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *