Follow the practice of running Docker (http://www.dockone.io/article/431) in Jenkins (Docker).
With this article, you can quickly learn how to load Docker sock in a container (here is the Jenkins container) to create its "brother" container, which some call Dood (Docker-outside-of-docker), To distinguish it from Dind (Docker-in-docker), which is the installation of a complete isolated Docker version in the container. Of course, you can also use Docker commands in the Jenkins container to perform other Docker-related operations. In practice, the source code (mainly Dockerfile and README.MD) is hosted on GitHub.
1. Pull source from GitHubgit clone https://github.com/donhui/docker-jenkins.git
2. Build the imageDocker build-t myname/jenkins:1.609.1 Docker-jenkins/dockerfile
3. Run the container based on the image (Be careful to map docker.sock and Docker to the Jenkins container.
) Docker run-d--name myjenkins-v/var/run/docker.sock:/var/run/docker.sock-v $ (which Docker):/usr/bin/docker-p 808 0:8080 myname/jenkins:1.609.1
4, Jenkins create job, build step Choose Execute shell, content: sudo docker images, post-build log output as follows:
Reference: Official Jenkins image (Https://github.com/jenkinsci/docker)
Running-docker-in-jenkins-in-docker (http://container-solutions.com/running-docker-in-jenkins-in-docker/)
Running-docker-in-jenkins-in-docker Chinese Translation version (http://www.dockone.io/article/431)
Run Docker practices in Jenkins (Docker)