docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx 1.16.1 55c440ba1ecb 3 days ago 127MB
修改tag
1
docker tag 55c440ba1ecb 172.16.64.233/my-project/nginx:1.16.1
推镜像
1 2 3
docker push 172.16.64.233/my-project/nginx:1.16.1 The push refers to repository [172.16.64.233/my-project/nginx] Get https://172.16.64.233/v2/: dial tcp 172.16.64.233:443: connect: connection refused
所以需要加入insecure-registries配置
1
vi /etc/docker/daemon.json
添加如下内容:
1 2 3
{ "insecure-registries": ["172.16.64.233"] }
重启docker
1
systemctl restart docker
再次推送
1 2 3 4 5 6
docker push 172.16.64.233/my-project/nginx:1.16.1 The push refers to repository [172.16.64.233/my-project/nginx] 37ec257a56ed: Preparing 567538016328: Preparing 488dfecc21b1: Preparing denied: requested access to the resource is denied
出现权限不够的错误。
所以需要登录。之前我们注册了一个user用户。
1 2 3 4 5 6 7 8
docker login 172.16.64.233 Username: user Password: WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
再次push
1 2 3 4 5 6
docker push 172.16.64.233/my-project/nginx:1.16.1 The push refers to repository [172.16.64.233/my-project/nginx] 37ec257a56ed: Pushed 567538016328: Pushed 488dfecc21b1: Pushed 1.16.1: digest: sha256:5f281748501a5ad9f5d657fc6067ac6187d62be2a811c460deee1504cabddc51 size: 948
成功。
在harbor页面里,也可以看到此镜像了。
拉取镜像
我们可以换一台机器,拉取镜像。
1 2
docker pull 172.16.64.233/my-project/nginx:1.16.1 Error response from daemon: Get https://172.16.64.233/v2/: dial tcp 172.16.64.233:443: connect: connection refused