Jenkins in a Docker container, with Docker, sudo and vim inside
334
jenkins-docker Jenkins in a Docker container, with Docker, sudo and vim inside.
Thanks to 4oh4. I appreciate his work and Idea for Jenkins-Docker.
Running Jenkins in Docker makes a lot of sense: its super quick to get going, and you can just expose the ports needed to access via the web interface. But it also makes sense to run your test cases/builds inside Docker as well: its compartmentalized, with full control of the environment inside.
This Dockerfile just takes the current, official Jenkins long term support (LTS) Docker image, installs Docker CE inside, and adds the jenkins user to the docker group.
It is recommended to create an explicit volume on the host machine, that will survive the container stop/restart/deletion. Use this argument when you run Docker: -v jenkins_home:/var/jenkins_home
Docker in Docker It's possible to run into some problems with Docker running inside another Docker container. A better approach is that a container does not run its own Docker daemon, but connects to the Docker daemon of the host system. That means, you will have a Docker CLI in the container, as well as on the host system, but they both connect to one and the same Docker daemon. At any time, there is only one Docker daemon running in your machine, the one running on the host system. To do this, you just bind mount to the host system daemon, using this argument when you run Docker: -v /var/run/docker.sock:/var/run/docker.sock
Running the container The easiest way is to pull from Docker Hub:
docker run -it -p 8080:8080 -p 50000:50000
-v jenkins_home:/var/jenkins_home
-v /var/run/docker.sock:/var/run/docker.sock
--restart unless-stopped
vijaymihiran/jenkins-docker
Content type
Image
Digest
Size
574.3 MB
Last updated
over 6 years ago
docker pull vijaymihiran/docker_jenkins