How to run Jenkins in Docker
How do I run Jenkins in Docker? In view of this problem, today the editor summarizes this article about running Jenkins in Docker, which can be used as a reference for interested friends. I hope it will be helpful to you.
Jenkins provides an official Docker image, so it is not difficult to run jenkins under docker. If you want to run in a production environment, you need to carefully consider the details of the operation, especially the file mount of the work path.
Initialization operation
If you just want to give it a try, it's simple: docker run jenkins
Of course, you can first run a temporary container like this to copy the required initial files in the container.
Production environment operation
Docker run\
-- name jenkins\-v / mnt/db1/jenkins/jenkins_home:/var/jenkins_home\-v / root/.ssh/id_rsa:/root/.ssh/id_rsa:ro\-v / root/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub:ro\-v / etc/localtime:/etc/localtime:ro\-v / etc/timezone:/etc/timezone:ro\-v / mnt/db1/jenkins/.m2:/root/ .m2\-v / mnt/db1/jenkins/maven:/usr/local/maven\-v / mnt/db1/jenkins/share:/usr/share/jenkins\-u root\-- restart always\-- network right-service\-- ip 172.18.0.4\-- privileged=true\-d jenkins/jenkins:lts read the above Have you mastered the method of running Jenkins in Docker? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!