Reputation: 3136
I have to keep committing on running docker containers, with timestamp tags. This creates new docker images.
Now, I want to get rid of old images from which the container was spawned in the beginning, cause it wont be used anymore.
I can write code to do this using a lot of logic and regex but, is there any other graceful way to do this?
How does the docker community do this?
Upvotes: 1
Views: 563
Reputation: 1
Don't forget to do this only after committing the container. If you delete the original image of a container, then docker will throw an error (no such file or directory) when you try to commit it
Upvotes: 0
Reputation: 3363
You can clean up unused Docker images at any time using this command:
docker image prune -a
This will remove all Docker images without at least one container associated to them. This includes dangling images:
-a Remove all unused images, not just dangling ones
Upvotes: 1