1、命令行登陆 harbar 镜像仓库
[root@node1 harbor]# docker login 192.168.27.134:9901
Username: admin
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
2、修改镜像tag
docker tag ubuntu:latest 192.168.27.134:9901/library/ubuntu:latest
3、push 镜像
[root@node1 harbor]# docker push 192.168.27.134:9901/library/ubuntu:latest
The push refers to repository [192.168.27.134:9901/library/ubuntu]
1852b2300972: Pushed
03c9b9f537a4: Pushed
8c98131d2d1d: Pushed
cc4590d6a718: Pushed
latest: digest: sha256:0925d086715714114c1988f7c947db94064fd385e171a63c07730f1fa014e6f9 size: 1152
4、页面上查看
5、在另一台虚拟机上,下载该镜像
[root@node2 ~]# docker pull 192.168.27.134:9901/library/ubuntu:latest
latest: Pulling from library/ubuntu
423ae2b273f4: Pull complete
de83a2304fa1: Pull complete
f9a83bce3af0: Pull complete
b6b53be908de: Pull complete
Digest: sha256:0925d086715714114c1988f7c947db94064fd385e171a63c07730f1fa014e6f9
Status: Downloaded newer image for 192.168.27.134:9901/library/ubuntu:latest
注意,该虚拟机需要配置daemon.json 文件
[root@node2 ~]# cat /etc/docker/daemon.json
{
"insecure-registries" : ["192.168.27.134:9901","192.168.27.134"]
}