docker pull jenkins/jenkins:lts
F:\images>docker pull jenkins/jenkins:lts
lts: Pulling from jenkins/jenkins
cdd62bf39133: Already exists
21f106ffc421: Pull complete
39df2c5808cf: Pull complete
d9d5ad5daae2: Pull complete
21d9152ebad0: Pull complete
ddc06df74615: Pull complete
bf388b3d4868: Pull complete
1f6fc1ff002b: Pull complete
276b7c1ccf38: Pull complete
d9ab3d4a2c85: Pull complete
ac000fcb71de: Pull complete
79eacf1576c1: Pull complete
Digest: sha256:429647d4688daa3ca2520fb771a391bae8efa1e4def824b32345f13dde223227
Status: Downloaded newer image for jenkins/jenkins:lts
docker.io/jenkins/jenkins:lts
What's Next?
View summary of image vulnerabilities and recommendations → docker scout quickview jenkins/jenkins:lts
注:因为Jenkins容器里的用户是Jenkins,而主机用户不是Jenkins,就算是root也一样会报错:/var/jenkins_home/copy_reference_file.log: Permission denied,这个时候就需要在主机上面给主机地址赋予访问Jenkins容器的权限,Jenkins内部用的是uid 1000的user。
-privileged=true让容器具有root权限,便于进入容器
-p 8080:8080指定主机8080端口映射到Jenkins容器的8080端口(Jenkins的web访问端口)
-v /home/jenkins:/var/jenkins_home容器/var/jenkins_home路径挂载到宿主机/home/jenkins路径
jenkens在linux环境部署
docker run -d --name jenkins -p 8080:8080 -p 8888:8888 -p 50000:50000 -v /usr/local/java/jdk1.8:/usr/local/src/jdk/jdk1.8 -v /opt/apache-maven-3.6.3:/opt/apache-maven-3.5.0 -v /home/jenkins:/var/jenkins_home --privileged=true jenkins/jenkins:lts
指令说明
-d:在后台运行容器
-p 8080:8080 :容器的端口8080到主机上的端口8080
-p 50000:50000 :公开主机上的 Docker 守护进程端口
-v jenkins-data:/var/jenkins_home :将容器的 /var/jenkins_home 目录映射到宿主机中的 /home/jenkins-data目录
在浏览器中输入http:127.0.0.1:8080访问jenkins
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » docker搭建jenkins
发表评论 取消回复