Sign inSign up

fdoxyz/jenkins-slave

By fdoxyz

•Updated over 10 years ago

Jenkins slave prepared to execute docker commands

Image
0

1.6K

fdoxyz/jenkins-slave repository overview

Dockerfile source⁠

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

# 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

Tag summary

Content type

Image

Digest

Size

219.7 MB

Last updated

over 10 years ago

docker pull fdoxyz/jenkins-slave