Public Repository

Last pushed: a year 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 <fdov88@gmail.com>

# 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     pam_loginuid.so|session    optional     pam_loginuid.so|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
EXPOSE 22

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

Run

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 \
    fdoxyz/jenkins-slave
Docker Pull Command
Owner
fdoxyz

Comments (0)