Docker deletes all containers and images

1. Stop all containers

docker stop $(docker ps -q)

2. Delete all containers

docker rm $(docker ps -aq)

3. Delete all mirrors

docker rmi `docker images -q`

or

docker rmi $(docker images -q) 

There may be unclean deleted, plus -f

docker rmi $(docker images -q) -f

Note:
1️⃣If you simply delete the container, you need to stop the container first, and then delete it in rm;
2️⃣If you need to delete the image, you need to stop and delete the container before you can start to delete the image;

Guess you like

Origin blog.csdn.net/weixin_44455388/article/details/107543333