【工具使用】Docker 推送镜像到harbor

目录

        • 前言
        • 添加仓库到insecure-registries
        • 按要求docker tag&docker push镜像

前言

以为很简单的镜像推送,无非docker login然后docker push,试一下:

$ docker login http://10.211.55.34
Username: honey
Password: 
Error response from daemon: Get https://10.211.55.34/v2/: Service Unavailable

添加仓库到insecure-registries

需要修改本机的/etc/docker/daemon.json
本人使用的mac,可以在界面修改:
【工具使用】Docker 推送镜像到harbor_第1张图片
配置/etc/hosts(就算是上一步insecure-registries配置的ip,这一步也要配置)

$ vi /etc/hosts
10.211.55.34 harbor.dataos.io

再次login

$ docker login 10.211.55.34                      
Username: honey
Password: 
Login Succeeded
$ docker push harbor.dataos.io/test_services/service_test:develop
The push refers to repository [harbor.dataos.io/test_services/service_test]
Get https://harbor.dataos.io/v2/: Service Unavailable

按要求docker tag&docker push镜像

查看harbor ui 推送镜像提示:

#在项目中标记镜像
docker tag SOURCE_IMAGE[:TAG] 10.211.55.34/test_services/IMAGE[:TAG]
#推送镜像到当前项目:
docker push 10.211.55.34/test_services/IMAGE[:TAG]

重新docker tag & docker push

$ docker tag harbor.dataos.io/test_services/service_registry:develop 10.211.55.34/test_services/service_test:develop
$ docker push 10.211.55.34/test_services/service_test:develop
The push refers to repository [10.211.55.34/test_services/service_test]
3993d96ee038: Pushed 
ceaf9e1ebef5: Pushed 
9b9b7f3d56a0: Pushed 
f1b5933fe4b5: Pushed 
develop: digest: sha256:4232727c53fd0d0c75f4cd3a0af594468d2511daa15c01fc58ccefbbae98b3c8 size: 1136


参考链接:
https://my.oschina.net/u/2518341/blog/3013760

你可能感兴趣的:(工具使用)