An open API service indexing awesome lists of open source software.

https://github.com/jgontrum/jenkins-dind-slave

Finally a *working* Dockerfile for a Docker-in-Docker Jenkins slave
https://github.com/jgontrum/jenkins-dind-slave

ci continuous-integration docker jenkins

Last synced: about 1 month ago
JSON representation

Finally a *working* Dockerfile for a Docker-in-Docker Jenkins slave

Awesome Lists containing this project

README

        

# Jenkins Docker-in-Docker slave

None of the existing Dockerfiles are working anymore, so I wrote one from scratch.

Usecase: Run Jenkins as a Docker container and use other containers (Jenkins slaves) to execute build files.

# Configuration

1. Follow this guide: https://www.katacoda.com/courses/jenkins/build-docker-images
- The guide suggests exposing the Docker API to everyone (IP 0.0.0.0), which is very insecure. However, the address is needed for the Jenkins container to start its slaves. Solve this by adding following entries to `iptables`, assuming you use port 4243 for the Docker API.
- `-A INPUT -s 172.0.0.0/8 -p tcp -m tcp --dport 4243 -j ACCEPT`
- `-A INPUT -s 127.0.0.1/32 -p tcp -m tcp --dport 4243 -j ACCEPT`
- `-A INPUT -p tcp -m tcp --dport 4243 -j DROP`
2. When starting the jenkins container, mount volume `/var/run/docker.sock:/var/run/docker.sock`
3. Use the following image instead of the one mentioned in the tutorial: `jgontrum/jenkins-dind-slave`
4. Settings in Manage Jenkins -> Cloud -> Container Settings:
- Volumes: /var/run/docker.sock:/var/run/docker.sock
- Run container privileged: Yes
5. Launch credentials: User/PW - jenkins:jenkins