docker install jenkins notes

Prerequisite: already installed docker-ce, run the command docker

command:

sudo docker pull jenkins

mkdir -p ~/dockers/jenkins
cd ~/dockers
sudo docker run --name jenkins01 -p 8081:8080 -p 50000:50000 -v ${PWD}/jenkins:/var/jenkins_home jenkins:latest

Error:

touch: Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied

Need to modify the directory permissions, because when the local data is mapped, / home / docker / owner of the root directory is jenkins user, the User uid container jenkins 1000

sudo chown -R 1000:1000 ~/dockers/jenkins

sudo docker rm jenkins01 

sudo docker run --name jenkins01 -p 8081:8080 -p 50000:50000 -v ${PWD}/jenkins:/var/jenkins_home jenkins:latest

Running for some time, you can see the output of the initialization code

images/191204/fs20191204000023.jpg

Accessible via a browser http://ip:8081to enter the initial page, enter the original administrator password

images/191204/fs2019120400003s.jpg

images/191204/fs2019120400004O.jpg

Choose "install the recommended plug-in" or "selected plug-ins to install."

images/191204/fs2019120400005s.jpg

Wait for plug-in installation is complete, then Continuethe next step, enter the Create First Admin Userpage to create the first admin user, then click Save and Finish, into jenkins home.

images/191204/fs2019120400006m.jpg

So far, docker version jenkins installation has been completed.

References

Guess you like

Origin www.cnblogs.com/fsong/p/12036805.html