往harbor上传镜像

下载镜像并给镜像打tag

[root@hdss7-200 harbor]# docker pull nginx:1.7.9
[root@hdss7-200 harbor]# docker images |grep 1.7.9
[root@hdss7-200 harbor]# docker tag 84581e99d807 harbor的ip/public/nginx:v1.7.9

登录harbor并上传到仓库

[root@hdss7-200 harbor]# docker login harbor的ip
[root@hdss7-200 harbor]# docker push harbor的ip/public/nginx:v1.7.9

报错

[root@obitomayyds docker]# docker login harbor的ip
Username: admin
Password:
Error response from daemon: Get http://172.26.130.201/v2/: dial tcp 172.26.130.201:80: connect: connection refused

解决方案:

# find / -name docker.service -type f
/etc/systemd/system/docker.service

vim /etc/systemd/system/docker.service


修改配置文件, 增加  --insecure-registry=harbor的ip 选项
[Service]下!!!ExecStart这一行!!!
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
#ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecStart=/usr/bin/dockerd --insecure-registry=172.26.130.201
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

重新启动服务

systemctl daemon-reload
 
systemctl restart docker
上一篇:curl 访问harbor v2.2.2 api


下一篇:harbor仓库复制同步