New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker rmi could have a --deep option? #11139

Open
timepieces141 opened this Issue Mar 3, 2015 · 3 comments

Comments

Projects
None yet
5 participants
@timepieces141

timepieces141 commented Mar 3, 2015

When we pull down a select group of docker images and fire up a cluster of containers based on them, on our project we tend to refer to them by their name:tag. When we choose to dynamically clean up the pulled images, we have to do some bash magic to determine the Image ID of a given name:tag before calling docker rmi. But it would be really nice to be able to call docker rmi --deep [name:tag] and docker would remove not just the local tag, but all tag references and the image. Currently if you are removing using name:tag, you have to delete each tag, and the last one deletes the actual image (understandable default behavior).

This would be handy for CI/CD workflows that run integration/system tests on dynamically produced and tagged docker image clusters.

Just food for thought...

@estesp

This comment has been minimized.

Contributor

estesp commented Mar 3, 2015

See #11058; not the exact same, but I noted in the comments that in a sense that "fix" is a proposal for something similar to what you are asking, although in that case it is by ID with -f that will do a "deep" rm.

@timepieces141

This comment has been minimized.

timepieces141 commented Mar 3, 2015

It is a similar issue, but keep in mind the behavior I am looking for already exists, just by ID. docker rmi [image_id] without any flags will remove the image and any tagged references, and is the behavior I want. I would just like that extended to referring to the image by name:tag.

Maybe a better way to describe it would be: docker rmi [image_id|name] could remove the image and any tagged references (current behavior for image, new behavior for name), and a new command, say docker untag [name:tag], could be added to maintain the current behavior of docker rmi [name:tag] which just removes the tag reference to the named image.

@terencechow

This comment has been minimized.

terencechow commented Sep 25, 2016

Was gonna work on this but it seems that this recommended feature is pretty much the intended behaviour.

Whenever [name:tag] points to a unique image then docker rmi [name:tag] has the same functionality as docker rmi [image_id] (which is what @timepieces141 asked for).

When [name:tag] points to a duplicate image then docker rmi [name:tag] will untag the aliased image and remove it from your image list, while docker rmi [image_id] will give an error saying you can't remove the image because it is referenced in more than 1 repo.

Hence in the second scenario, docker rmi image_id doesn't give the intended behaviour that @timepieces141 was asking for anyways and I think the current behaviour is pretty logical, i.e. it removes a duplicate image from your list which just has a different tag name.

I'd recommend closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment