Docker Community Forums

Share and learn in the Docker community.

Tagging - how to get rid of additional copies?

dockerhub

(Vrms) #1

have had problem with pushing a local image to dockerhub and tried to solve that with tagging.
now I ended up with several copies of the same image in different tags. actually I even have 2 version og the same image with the exact same tagging

how can I get rid of everything I do not need any longer (without deleting the actual image)?

ubuntu 15.10 is my host, docker is 1.1.11


(David Maze) #2

Careful use of docker rmi. docker rmi will, first, remove a tag on an image; second, if no tags remain on that image layer, delete the layer; third, if no tags remain on the parent layer (or further ancestors), delete those layers too.

So if docker images says I have image tags dmaze/foo:latest, dmaze/foo:1.0, and registry.example.com/dmaze/foo:latest, all pointing at the same hex image tag, docker rmi dmaze/foo:latest dmaze/foo:1.0 will just delete the extraneous tags but leave the actual image behind (the tag registry.example.com/dmaze/foo:latest is still pointing at it).


(Vrms) #3

great, that works. Thank you.