Skip to content

Command Collection

Docker Container

List the names and sizes of the containers:

Terminal window
docker ps -a --format '{{.Names}} {{.Size}}'

Delete all containers, including stopped ones:

Terminal window
docker rm $(docker ps -aq)

View real-time CPU and memory usage of containers:

Terminal window
docker stats | grep ''

Or:

Terminal window
docker stats | grep <container_name_or_id>

Docker Image

Delete all images, including both tagged and untagged ones:

Terminal window
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:

Terminal window
docker system prune -a --volumes --force

or

Terminal window
docker system prune -a