linux containers – Docker how to change repository name or rename image?

linux containers – Docker how to change repository name or rename image?

docker image tag server:latest myname/server:latest

or

docker image 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 dont like the old name you can remove it after youve retagged it:

docker rmi server

That will just remove the alias/tag. Since d583c3ac45fd has other names, the actual image wont 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, thats all you need.

Finally, you can remove the old image as follows:

docker rmi server

linux containers – Docker how to change repository name or rename image?

Recently I had to migrate some images from Docker registry (docker.mycompany.com) to Artifactory (docker.artifactory.mycompany.com)

docker pull docker.mycompany.com/something/redis:4.0.10
docker tag docker.mycompany.com/something/redis:4.0.10 docker.artifactory.mycompany.com/something/redis:4.0.10
docker push docker.artifactory.mycompany.com/something/redis:4.0.10

Leave a Reply

Your email address will not be published.