-
Notifications
You must be signed in to change notification settings - Fork 40
Destroying images #16
base: master
Are you sure you want to change the base?
Conversation
Ok, I actually solved this using
But im getting an error here If the container is stopped, this delete the container and the first part, deletes the images. Any idea why? This is the log
Update: I've solved this catching the exception. Probably not the best way to do it, but it does the trick |
I can make a pull request about this @jkeiser |
Sounds great! |
Converted into PR |
begin | ||
Chef::Log.debug("Removing #{container_name}") | ||
container.delete | ||
rescue Docker::Error::ServerError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading the docs, this is hiding a 500 (meaning there is an issue with the Docker code). Is there a corresponding bug filed in Docker itself?
I'd feel a lot more comfortable here if we did an if container.exists? (or its equivalent) rather than catching all 500's and saying they are OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to destroy any containers when we destroy the image? The Docker CLI tool requires -f
to delete images used by live containers.
Rigth now there is a bug when trying to destroy images.
Here is the problem
But in docker-api docs says that we should get the image by his ID