前两篇中,介绍了如何搭建个人私有镜像仓库Harbor,并编写了一个goweb项目进行打包上传,本文则继续介绍如何利用jenkins 实现自动打包镜像并上传。
mkdir jenkins
cd jenkins
vim vim docker-compose.yml
version: "3.1"
services:
jenkins:
image: jenkins/jenkins
container_name: jenkins
ports:
- 8080:8080
- 50000:50000
volumes:
- ./data/:/var/jenkins_home/
- /usr/bin/docker:/usr/bin/docker
- /var/run/docker.sock:/var/run/docker.sock
- /etc/docker/daemon.json:/etc/docker/daemon.json
执行 docker-compose up -d
发现jenkins并没有启动并且执行docker logs输出如下报错:
docker logs fa9f80b44831
------
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?
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?
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?
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?
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?
看了下主要是因为data文件没有权限的原因,我直接777大法:
chmod 777 ./data
重新执行docker-compose up -d
记住这一串,后面登陆系统需要用到。
访问ip:8080 , 发现可以启动了。不上技术手段是不行的。
最后,选择默认插件->创建账户。
话说回来,aliyun 2c2g,想玩云原生不太行。文章先到这吧,等攒钱换个新服务器😂再继续更新。