Docker images, containers and volumes - list and delete commands
Here is compiled list of commands to list and delete images, containers and volumes.
Images
List:
docker images -a
docker images -f dangling=true
Delete:
docker rmi Image
### Remove dangling
docker images purge
### Remove all
docker rmi $(docker images -a -q)
Containers
List:
docker ps -a
### List all exited containers
docker ps -a -f status=exited
Remove:
docker rm ID_or_Name
### Remove all exited containers
docker rm $(docker ps -a -f status=exited -q)
### Stop containers
docker stop $(docker ps -a -q)
Volumes
List:
### All
docker volume ls
### Dangling
docker volume ls -f dangling=true
Remove:
docker volume rm volume_name
### Remove dangling
docker volume prune
### Remove container and its volume at the same time
docker rm -v container_name