Docker 初始化部署
获取 docker jenkins 镜像
1 2 3 4 5
| docker pull jenkins/jenkins:lts
docker pull jenkins/jenkins
|
初始 参数解释
docker 环境 目录 /var/jenkins_home 映射宿主目录 ~/jenkins
docker 环境 端口 8080 映射宿主端口 8002
1 2 3 4 5
| docker run -d -p 8002:8080 -v ~/jenkins:/var/jenkins_home --name jenkins --restart=always jenkins/jenkins
docker logs -f jenkins
|
发现错误日志
1 2
| touch: cannot touch '/var/jenkins_home/xxxx.log': Permission denied Can not write to /var/jenkins_home/xxxx.log. Wrong volume permissions?
|
需要在 宿主 对目录授权 ~/jenkins
1 2 3 4 5
| sudo chmod a+rwx ~/jenkins
sudo chmod a+rw /var/run/docker.sock
|
Docker 中更新 jenkins
宿主下载 jenkins.war 目录 ~/jenkins,进入 docker shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| docker exec -it 861b /bin/bash
docker exec -it -u root 861b /bin/bash
cp /var/jenkins_home/jenkins.war /usr/share/jenkins/jenkins.war exit
docker restart 861b
wget -O sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip && unzip sdk.zip -d android.sdk && rm sdk.zip
|