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
- Host: GitHub
- URL: https://github.com/jgontrum/jenkins-dind-slave
- Owner: jgontrum
- License: mit
- Created: 2017-09-24T09:23:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-24T09:48:37.000Z (over 7 years ago)
- Last Synced: 2025-01-27T08:13:43.848Z (3 months ago)
- Topics: ci, continuous-integration, docker, jenkins
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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