Create a Dockerfile with the following contents
FROM jenkins:2.32.3
USER root
RUN apt-get -qq update \
&& apt-get -qq -y install \
curl
RUN curl -sSL https://get.docker.com/ | sh
RUN usermod -a -G staff jenkins
USER jenkins
Create an image:
docker build -t jenkins_docker .
Run the container:
docker run -d -p 8080:8080 -p 4040:4040 -v /var/run/docker.sock:/var/run/docker.sock jenkins_docker
Demo: https://drive.google.com/file/d/0Bz8VjLQTuhwvT05wMlFrYnJwZVE/view?usp=sharing
This code does not work.
Docker version: 17.12.1-ce
Error:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.37/version: dial unix /var/run/docker.sock: connect: permission denied
This work only when USER root, not USER jenkins.
Any ideas?