问题:启动容器后容器状态一直为Restarting(1)
docker run -dit -v /home/jenkins/:/var/jenkins_home -p 8080:8080 -p 50000:50000 --name jenkins11 jenkins/jenkins:lts-jdk11
查看日志
[root@192 jenkins]# docker logs jenkins01 touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
解决办法:
本地创建Jenkins用户和组
本地挂载的文件夹用户和组更改为Jenkins
46 groupadd jenkins 47 useradd jenkins -g jenkins 48 chown -R jenkins:jenkins /home/jenkins/
在run命令中加入--privileged=true
参数,为container内的root拥有真正的root权限
docker run -dit -v /home/jenkins/:/var/jenkins_home -p 8080:8080 -p 50000:50000 --name jenkins11 --privileged=true jenkins/jenkins:lts-jdk11