Public Repository

Last pushed: 2 years ago
Short Description
Jenkins slave prepared to execute docker commands
Full Description

Dockerfile source

# Clean Dockerfile for a Jenkins slave node to execute docker tests with mounted socket & client
FROM debian:jessie
MAINTAINER Fernando Valverde <>

# Install dependencies
RUN apt-get update && \
    apt-get -y upgrade && \
    apt-get install -y openssh-server sudo openjdk-7-jdk && \
    sed -i 's|session    required|session    optional|g' /etc/pam.d/sshd && \
    mkdir -p /var/run/sshd

# Add user jenkins to the image as sudoer
RUN adduser -q jenkins && \
    echo "jenkins:jenkins" | chpasswd && \
    echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers

# Standard SSH port

CMD ["/usr/sbin/sshd", "-D"]


You will need to mount several things like the docker socket, client and in my case I needed to mount a couple of libraries that docker needed (/lib/x86_64-linux-gnu and /usr/lib/x86_64-linux-gnu as read-only fix this problem).

docker run -d \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v $(which docker):/usr/bin/docker \
    -v /lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:ro \
    -v /usr/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:ro \
    --privileged \
    --name jenkins-slave \
Docker Pull Command