Skip to content
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

dcgc does not detect :latest automatically #24

Open
schmunk42 opened this issue Jan 25, 2016 · 2 comments
Open

dcgc does not detect :latest automatically #24

schmunk42 opened this issue Jan 25, 2016 · 2 comments

Comments

@schmunk42
Copy link

I noticed when running dcgc that it tried to remove images from containers which have been started without any tag.
If an image was started with :latest it does not try to remove it.

Kraftbuch:~ tobias$ docker run -ti     -v /var/run/docker.sock:/var/run/docker.sock     yelp/docker-custodian dcgc --max-image-age=30d
Getting all containers
Found 53 containers
Getting all images
Found 111 images
Removing image 52e2cc6d3b9132a2 tutum/couchdb:latest
Error calling remove_image tutum/couchdb:latest 409 Client Error: Conflict ("conflict: unable to remove repository reference "tutum/couchdb:latest" (must force) - container c11508d13abb is using its referenced image 52e2cc6d3b91")
Removing image 7c93d6e7947e2b74 yelp/docker-custodian:latest
Error calling remove_image yelp/docker-custodian:latest 409 Client Error: Conflict ("conflict: unable to remove repository reference "yelp/docker-custodian:latest" (must force) - container 38cbffb93181 is using its referenced image 7c93d6e7947e")

There's noting going wrong, but it would be nice if there could be a more exact parsing of the running images list.

Eg, I had this container running:

c11508d13abb        tutum/couchdb                        "/run.sh"                 26 minutes ago      Up 26 minutes

Surprisingly, if I start a container with docker run -d tutum/couchdb:latest it does not try to remove any of tutum/couchdb or tutum/couchdb:latest.

@dnephin
Copy link
Contributor

dnephin commented Jan 27, 2016

Ah makes sense. While constructing the set of "all images being used by containers" we should append the :latest tag to any images that don't have tags, so that the set operations match correctly.

Or maybe using image ids instead would work.

@schmunk42
Copy link
Author

I think IDs would even be better, since there could be :1.0.0,:latest and none pointing to the same image.

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

No branches or pull requests

2 participants