Docker tag命令为镜像重命名(仓库地址、标签)

1、使用docker tag使用镜像ID重命名

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        9 weeks ago         1.84 kB
$ docker tag fce289e99eb9 hello-world:v1
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        9 weeks ago         1.84 kB
hello-world         v1                  fce289e99eb9        9 weeks ago         1.84 kB

2、使用docker tag使用镜像tag重命名

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        9 weeks ago         1.84 kB
hello-world         v1                  fce289e99eb9        9 weeks ago         1.84 kB
$ docker tag hello-world:latest hello-world:v2
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        9 weeks ago         1.84 kB
hello-world         v1                  fce289e99eb9        9 weeks ago         1.84 kB
hello-world         v2                  fce289e99eb9        9 weeks ago         1.84 kB

注意:这里的tag在命名的时候遵循 仓库地址+端口+镜像所在路径+标签 的规则(例如:10.12.1.202:8088/oascloud/openailab-authorization-management:v1.4.0),否则在镜像推送的时候会找不到仓库地址

docker tag命令使用方法的介绍到此结束。

发布了341 篇原创文章 · 获赞 376 · 访问量 36万+

猜你喜欢

转载自blog.csdn.net/qq_19734597/article/details/103740648
今日推荐