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.

沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...