Use Docker Jenkins installation services

1, download Jenkins from Docker Hub mirror :( https://hub.docker.com/search?q=jenkins&type=image )

docker pull jenkins/jenkins:lts

 

 

 2, create the corresponding directory on the local map

mkdir -p /XXXX/XXX/XX

3, starting Jenkins :( specify a host machine ~ / XXX directory is mounted to the container / var / jenkins_home directory) so that data can be persistent, even if the container restart, data is not lost

docker run -d --name container_name -p 8080:8080 -p 50000:50000 -v ~/XXX:/var/jenkins_home jenkins/jenkins:lts

 

4, pages visited Jenkins, host IP: 8080

 

 

5, to obtain the initial password:
One way: the need to enter the container:
1) into the container
docker exec -it container_name bash
2) Check the corresponding password
cat /var/jenkins_home/secrets/initialAdminPassword

 

 Second way: directly docker logs container_name

 

 

6, enter the corresponding password, to build complete Jenkins

Guess you like

Origin www.cnblogs.com/91parson/p/12149769.html