docker 快速部署 Jenkins
version: '3'
services:
jenkins:
image: jenkins/jenkins
container_name: myjenkins
restart: always
hostname: myjenkins_host
ports:
- 18181:8080 # 界面端口
- 18182:50000 # api
volumes:
- ./jenkins_mount:/var/jenkins_home #挂载 jenkins目录
- /etc/localtime:/etc/localtime #同步时间
environment:
- privileged=ture
注意 会报这个错误
myjenkins | touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
原因: 在root用户下运行时, 文件夹是root的 需要添加权限
chown -R 1000:1000 ./jenkins_mount/