Docker Community Forums

Share and learn in the Docker community.

Docker: not found in Jenkins pipeline

I get this error message when running a custom image based on jenkins/jenkins in docker swarm mode: Ignoring unsupported options: privileged

My custom image has blue ocean plugin installed. Here is the compose file:

version: "3.5"


        user: root
        privileged: true
            - JENKINS_OPTS='--prefix=/jenkins'
            - /var/run/docker.sock:/var/run/docker.sock
            - jenkins_home:/var/jenkins_home
            - jenkins-user
            - jenkins-pass


        external: true
        external: true

My Jenkinsfile / pipeline runs fine on Ubuntu but does not appear to work on RHEL 7.3 and complains docker: not found. My environment is:

  • RHEL Server release 7.3
  • Docker version 17.12.0-ce
  • Jenkins ver. 2.106

Has anyone got a jenkins pipeline working in docker swarm mode in RHEL 7.3?

@leoaref - I am stuck with the same problem that you reported back in Apr '17, docker: not found. Did you ever manage to resolve your issue?

I am able to run jenkins pipeline fine in ubuntu. but the same configuration and pipeline does not work in RHEL 7.3.

If you have found a resolution to you issue, I will be grateful if you could respond with the solution

Solution is to install docker in your jenkins container.

Anyone interested to find out more may want to take a look at

@jpetazzo is it possible to implement the side car pattern from a jenkins pipeline script where jenkins itself is installed on a container i.e. can the agent being instantiated from the pipeline script run from the host machine? Per your post, I would rather stay away from running docker inside a docker container.

Are there any example of installing the Docker CLI using your base image’s packaging system, or using the Docker API?

Edit: Never mind, that’s literally what you explain in the article thanks!

Yes, I found the solution. Following command is working fine for me.

docker run --rm -u root -p 8080:8080 -v jenkins-data:/var/jenkins_home -v $(which docker):/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -v "$HOME":/home jenkinsci/blueocean

it doesn’t work with me ,image . exec the command in docker container

You should not mount the binary as mentioned in the answer above but instead install the docker client in your container.
Reason is that the binary is linking against a shared library which you would need to mount as well into the container. But doing that would result in other issues (eg. wrong system dependencies).

Please have a look as well here:

Former versions of this post advised to bind-mount the docker binary from the host to the container. This is not reliable anymore, because the Docker Engine is no longer distributed as (almost) static libraries.

Thanks is worked for me i just added this

 -v $(which docker):/usr/bin/docker
1 Like

docker run --name jenkins -p 8080:8080 -p 50000:50000
-v /var/run/docker.sock:/var/run/docker.sock
-v $(which docker):/usr/bin/docker
-v /home/jenkins_home:/var/jenkins_home

1 Like

The following worked perfectly for me:

Basically the solution is to build a docker container which will build upon jenkins and install docker into it, at the end its basically jenkins with the docker client (not server) installed, and when running it you connect it to the host docker.sock as was mentioned above as well

1 Like

This blog, which I wrote, has plenty of info on the problems with running Jenkins pipelines with Docker.

I recently founded a company called Nestybox that has created a container runtime (aka runc) that enables Docker to deploy containers that act like virtual hosts and can run system-level software such as Docker in them, without using privileged containers. It solves many of the issues described by Jerome in his docker-in-docker blog post (see Jerome’s comment above).

We have a solution that runs Jenkins + Docker inside the system container, avoids many of the problems listed in this thread, and does so in complete isolation from the Docker on the host. Check it out, hopefully it will help!

1 Like

Awesome stuff! This worked perfectly for me! I simply spun up a ubuntu 19.04 VM, and followed the Sysbox Installation Guide and @ctalledo’s blog post and was able to get Docker working in Jenkins pipelines (running in a dockerized Jenkins installation). More details here.

I meet same issue, it fixed mine. Thanks.

this worked for me too.

docker run -u 0 --privileged --name jenkins -it -d -p 8080:8080 -p 50000:50000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/usr/bin/docker \
-v /home/jenkins_home:/var/jenkins_home \

Although using “–privileged” flag while starting docker container docker run -u 0 --privileged --name jenkins ... may allow enabling docker in Jenkins pipeline, there are certain implications of starting docker in privileged mode

tanx more need this work for me …
خرید گیفت کارت

This solution worked for me. Thank you!

Take another look at your suggestions. And then take it to see.


docker run -u 0 --privileged --name jenkins -d -p 8080:8080 -p 50000:50000 -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts

worked for me.