Docker how to change repository name or rename image?

I'm trying to change repository name of the image:

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
server              latest              d583c3ac45fd        26 minutes ago      685.5 MB

Hence I want to change the name server to something like myname/server :

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
myname/server       latest              d583c3ac45fd        26 minutes ago      685.5 MB

How can I do this?


docker tag server:latest myname/server:latest

or

docker tag d583c3ac45fd myname/server:latest

Tags are just human-readable aliases for the full image name ( d583c3ac45fd... ).

So you can have as many of them associated with the same image as you like. If you don't like the old name you can remove it after you've retagged it:

docker rmi server

That will just remove the alias/tag . Since d583c3ac45fd has other names, the actual image won't be deleted.


As a shorthand you can run:

docker tag d58 myname/server:latest

Where d58 represents the first 3 characters of the IMAGE ID in this case, that's all you need.

And finally, you can remove the old image as follows:

docker rmi server

docker run -it --name NEW_NAME Existing_name

To change the existing image name.

链接地址: http://www.djcxy.com/p/18268.html

上一篇: CMD运行后,将日志文件从Docker容器复制到主机

下一篇: Docker如何更改存储库名称或重命名映像?