Answer the question
In order to leave comments, you need to log in
How to remove unnecessary containers and images in docker?
Good afternoon. Connoisseurs, please tell me how to delete already unused containers and images in docker?
Let's say I've finished a project and want to delete everything related to it.
What I do:
- stop project containers docker-compose stop
- delete volumes docker-compose rm -v
but as far as I understand downloaded images remain. The docker images command lists all images. But how to understand which ones to delete among others? That is, roughly by name, I imagine, but there are many similar ones and I'm afraid to remove them from other projects. Perhaps there is some kind of docker-comose command to remove the images of the project?
Answer the question
In order to leave comments, you need to log in
And docker won't let you delete an image used in other containers without the --force option.
So you can just write docker image prune
https://vsupalov.com/cleaning-up-after-docker/ :
docker-compose down -v --rmi all --remove-orphans
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question