gitlab+harbor实现镜像中心
作者:互联网
harbor安装
1.docker-compose下载安装
https://github.com/docker/compose/releases
chmod a+x docker-compose
2.harbor下载安装
https://github.com/goharbor/harbor/releases
harbor开启https加密
生成证书
openssl req -newkey rsa:4096 -nodes -sha256 -keyout ca.key -x509 -days 3650 -out ca.crt
openssl req -newkey rsa:4096 -nodes -sha256 -keyout 10.240.4.159.key -out 10.240.4.159.csr
echo subjectAltName = IP:10.240.4.159 > extfile.cnf
openssl ca -in 10.240.4.159.csr -out 10.240.4.159.crt -cert ca.crt -keyfile ca.key -extfile extfile.cnf -days 3650 -outdir .
ps aux | grep docker 查看docker daemon有没有带--insecure-registry参数
vi harbor.yml
docker提交镜像到harbor
1.使用普通用户执行docker
#添加docker用户组
groupadd docker
#把需要执行的docker用户添加进该组,这里是ibaboss
gpasswd -a ibaboss docker
#重启docker
systemctl restart docker
su - ibaboss
#运行成功
docker ps -a
2.设置docker登录方式
vi /etc/docker/daemon.json
{
"insecure-registries": ["https://192.168.30.111"]
}
systemctl daemon-reload
systemctl restart docker
docker向harbor中推送镜像的时候必须要先在harbor中创建一个对应的项目,否则无法推送镜像。
docker从harbor中拉取镜像
docker pull 192.168.30.111/library/busybox:v1
成功从harbor中拉取到指定的镜像到本地
标签:harbor,ca,gitlab,10.240,镜像,docker,4.159 来源: https://www.cnblogs.com/yxh168/p/13214436.html