In the previous blog entry we created a base Java image that we can now use to create Docker based Jenkins slave.
FROM your_docker_registry_location/java:1.8.0_101 RUN adduser -D jenkins ; \ apk update ; \ apk add bash git openssh ; \ ssh-keygen -t rsa -b 8192 -N '' -f /etc/ssh/ssh_host_rsa_key ; \ echo "jenkins:your_password" | chpasswd COPY sshd_config /etc/ssh/sshd_config COPY settings.xml /home/jenkins/.m2/settings.xml RUN chown -R jenkins:jenkins /home/jenkins EXPOSE 22 CMD ["/usr/sbin/sshd", "-D"]
Note the above Dockerfile is a template that you can use, but you will have to fill in "your_docker_registry_location" and "your_password". And supply your own version of "sshd_config" and "settings.xml".
Posted September 1, 2016