Command Collection
Docker Container
List the names and sizes of the containers:
docker ps -a --format '{{.Names}} {{.Size}}'
Delete all containers, including stopped ones:
docker rm $(docker ps -aq)
View real-time CPU and memory usage of containers:
docker stats | grep ''
Or:
docker stats | grep <container_name_or_id>
Docker Image
Delete all images, including both tagged and untagged ones:
docker rmi $(docker images -a -q)
Docker in General
💡 Tip: Regularly pruning unused Docker resources can help prevent common errors and free up disk space:
docker system prune -a --volumes --force
or
docker system prune -a