Delete all docker images on your system:
docker rmi $(docker images -a -q)
This will:
- Use
docker images -a -q
to list all docker image IDs - Pass the list of IDs to
docker rmi
to remove them
A few things to note:
- This will delete all images, not just unused ones, so be careful running this if you have images you want to keep
- You may need to add
sudo
before the command or run as root user - To delete unused/dangling images instead, you can use:
docker image prune
Some other useful docker cleanup commands:
- Delete all stopped containers:
docker container prune
- Delete all networks not used by at least one container:
docker network prune
- Delete all build cache:
docker builder prune