程式扎記: [ 常見問題 ] Docker how to change repository name or rename image?

標籤

2016年3月10日 星期四

[ 常見問題 ] Docker how to change repository name or rename image?

Source From Here 
Question 
I'm trying to change repository name of the image: 
  1. REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE  
  2. server              latest              d583c3ac45fd        26 minutes ago      685.5 MB  
Hence I want to change the name server to something like myname/server
  1. REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE  
  2. myname/server       latest              d583c3ac45fd        26 minutes ago      685.5 MB  
How can I do this? 

How-To 
Using docker command tag



which means you can: 

# docker tag server:latest myname/server:latest

Or using image id: 
# 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 by docker command rmi
# docker rmi server

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

沒有留言:

張貼留言

網誌存檔

關於我自己

我的相片
Where there is a will, there is a way!