Gangmax Blog

Fourth Docker Notes

Batch remove Docker instances

From here.

1
2
3
4
# 1. Stop the Docker instances.
docker stop $(docker ps -aq)
# 2. Rmove the Docker instances.
docker rm $(docker ps -qa)

Batch remove Docker images

From here.

1
2
3
4
5
6
# 1. List the specific Docker images.
docker images | grep "x86_64-1.0.0-beta"
# 2. Remove the specific Docker images. The column "3" is the image ID column.
docker images | grep "x86_64-1.0.0-beta" | awk '{print $3}' | xargs docker rmi
# 3. Remove all the Docker images.
docker rmi $(docker images -aq)

Comments