I recently started using Docker and never realized that I should use docker-compose down
instead of ctrl-c
or docker-compose stop
to get rid of my experiments. I now have a large number of unneeded docker images locally.
Is there a flag I can run to delete all the local docker images & containers?
Something like docker rmi --all --force
--all flag does not exist but I am looking for something with similar idea.
To delete all Docker local Docker images follow 2 steps ::
step 1 : docker images ( list all docker images with ids )
step 2 : docker image rm 31e522c6cfe4 ( IMAGE ID)
Use this to delete everything:
https://docs.docker.com/engine/reference/commandline/system_prune/#extended-description
Adding to techtabu's accepted answer, If you're using docker on windows, you can use the following command
for /F "delims=" %A in ('docker ps -a -q') do docker rm %A
here, the command
docker ps -a -q
lists all the images and this list is passed todocker rm
one by onesee this for more details on how this type of command format works in windows cmd.
You can try like this:
To delete all images:
Explanation:
This command will return all image id's and then used to delete image using its id.