Reputation: 375
What artifacts do stopped docker containers leave on the host file system that makes it necessary to run the command "docker container prune". I thought docker containers where simply running versions of images that are suppose to be wiped out after they exit? In what scenarios are artifacts left behind if it is not always the case?
Upvotes: 14
Views: 4142
Reputation: 362087
If you don't use --rm
to auto-remove the container when it exits then the container is only stopped, not removed. It can be resumed with docker start
. You can run new commands inside it with docker exec
. All of the files that were modified during the container's runtime are still there: log files, data files, anything that was modified, added, or removed. Docker also keeps around metadata like the container's logs and its exit status in case you want to do a post mortem inspection.
It should be standard practice to use --rm
so containers clean up after themselves. Otherwise you'll have to periodically clean up your system.
Upvotes: 22