标签:push ror refers png store tab bin red utils
1.Habor简介[root@harbor opt]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@harbor opt]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum repolist 或者 yum makecache fast
[root@harbor opt]# yum install docker-ce -y
Login Succeeded
[root@node1 ~]# docker tag busybox reg.slito.com/library/busybox:v1
[root@node1 ~]# docker push reg.slito.com/library/busybox:v1
The push refers to repository [reg.slito.com/library/busybox]
8a788232037e: Pushed
v1: digest: sha256:915f390a8912e16d4beb8689720a17348f3f6d1a7b659697df850ab625ea29d5 size: 527
[root@node1 ~]#
在harbor中查看
6.下载harbor中的镜像
先删掉原来的镜像
[root@node1 ~]# docker rmi reg.slito.com/library/busybox:v1
重新从harbor pull
[root@node1 ~]# docker pull reg.slito.com/library/busybox:v1
确认
[root@node1 ~]# docker images | grep busybox
reg.slito.com/library/busybox v1 59788edf1f3e 8 weeks ago 1.15MB
7.配置https访问
1) 安装openssl
#yum install openssl -y
2) 创建证书的database文件index.txt和序列文件serial
[root@harbor opt]# touch /etc/pki/CA/index.txt
[root@harbor opt]# echo "01" > /etc/pki/CA/serial
3) 创建私钥,生成自签证书(用于发放给个人用户)
#(umask 077;openssl genrsa -out /etc/pki/CA/private/cakey.pem)
#openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -out /etc/pki/CA/cacert.pem
4) 客户端生成证书请求(.csr)
#cd /opt/harbor
#mkdir ssl
#cd ssl
#(umask 077;openssl genrsa -out reg.slito.com.key) \生成私钥
#openssl req -new -key reg.slito.com.key -out reg.slito.com.csr \ 生成证书请求
和上面cacert.pem生成时写的结果保持一致
5) 签发证书(本机是CA同时又是申请证书的客户端)
#cd /opt/harbor/ssl
#openssl ca -in reg.slito.com.csr -out reg.slito.com.crt -days 365
6) 修改配置文件,重新启动harbor
#cd /opt/harbor
#docker-compose down -v
#vim harbor.cfg
ui_url_protocol = https
ssl_cert = ./ssl/reg.slito.com.crt
ssl_cert_key = ./ssl/cert/reg.slito.com.key
secretkey_path = ./ssl/
#./prepare
#./install.sh
访问“https://reg.slito.com”
7) 其他主机访问harbor,pull/push镜像设置
拷贝reg.slito.com.crt到需要访问harbor仓库的主机上(/etc/docker/certs.d/reg.slito.com/),目标主机不用配置信任就可以直接访问。
#cp /opt/harbor/ssl/reg.slito.com.crt /etc/docker/certs.d/reg.slito.com/
其他:关于https访问,可以看另一篇博客http://blog.51cto.com/slitobo/1931603
企业级镜像仓库harbor搭建(http/https)及使用
标签:push ror refers png store tab bin red utils
原文地址:http://blog.51cto.com/slitobo/2323332