Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

docker rmi will fail if image has multiple repo:tag references #15

Closed
HardySimpson opened this issue May 18, 2015 · 3 comments
Closed

Comments

@HardySimpson
Copy link

Learn many from docker-gc. I didn't run docker-gc but read the code.

the docker-gc's way of remove a image is

docker rmi $(image_id)

if the image has multiple repo:tag reference to it, the command will fail.
my shell removes repo:tag instead of imageid mostly, avoid the bug.

@daenney daenney changed the title I write a new shell at https://github.com/HardySimpson/docker-cleanup docker rmi will fail if image has multiple repo:tag references Jul 28, 2015
@jaakkytt
Copy link

jaakkytt commented Aug 6, 2015

Also stumbled upon of this after seeing my image in images.reap not being deleted.
Ran the last line of the docker-gc file again:

$ xargs -n 1 docker rmi < images.reap 
Error response from daemon: Conflict, cannot delete image e33b075d9148c4ef66be11e7faa1d1a46144e10427fdb81406fff97270f61ca2 because it is tagged in multiple repositories, use -f to force
Error: failed to remove images: [e33b075d9148c4ef66be11e7faa1d1a46144e10427fdb81406fff97270f61ca2]

@dnephin
Copy link

dnephin commented Sep 1, 2015

If this is a critical issue for anyone, you might be interested in https://github.com/Yelp/docker-custodian (disclaimer: I'm the primary contributor), which has basically identical functionality to docker-gc (except that it's python not bash, has unit tests, and uses the api instead of the cli).

It handles this issue:
https://github.com/Yelp/docker-custodian/blob/v0.4.0/docker_custodian/docker_gc.py#L119

@arnib
Copy link
Contributor

arnib commented Dec 1, 2015

This should be fixed in #72, enable by using FORCE_IMAGE_REMOVAL=1 docker-gc

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants