以下是我的操作步骤:
1.获取nginx镜像
sudo docker pull nginx
这个时候镜像的情况
test@myTest:~/test$ sudo docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest de2222b9111b 8 days ago 142MB
2.打tag
sudo docker tag nginx:latest myTest/project-test/nginx:v1
这个时候镜像的情况
test@myTest:~/test$ sudo docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
myTest/project-test/nginx v1 de2222b9111b 8 days ago 142MB
nginx latest de2222b9111b 8 days ago 142MB
3.推送镜像
sudo docker push myTest/project-test/nginx:v1
test@myTest:~/test$ sudo docker push myTest/project-test/nginx:v1
The push refers to repository [myTest/project-test/nginx]
XXXXXXXXXXXX: Pushed
XXXXXXXXXXXX: Pushed
XXXXXXXXXXXX: Pushed
XXXXXXXXXXXX: Pushed
XXXXXXXXXXXX: Pushed
XXXXXXXXXXXX: Pushed
v1: digest: sha256:XXXXXXXXXXXXXX size: 1570
问题:通常来讲用浏览器打开http://myTest登录Harbor之后可以查看push的镜像,但是我在Harbor页面上没有看到push的镜像,可是在第3步镜像已经push了,有没有通过命令行确认push到Harbor的镜像呢?
结果是因为安装的版本是Harbor v1.10.11才出现这个问题,换成Harbor v2.4.1之后就没有这个问题了。