Check the local image list on the computer where the Docker image has been built. You may see the image in the red box in the figure below, which is displayed in the list: This kind of image is called dangling images
in the official Docker documentation, which means there is no tags and are not used by the container.
Official explanation
The official explanation is shown in the red box below, the address is: https://docs.docker.com/config/pruning/
Delete none image
- Query all none images
docker images | grep none
- Query the IDs of all none images
docker images | grep none | awk '{print $3}'
- Delete all none images
docker images | grep none | awk '{print $3}' | xargs docker rmi
When encountering image is being used by stopped container xxxxxx, you can type the following command
# 启动所有镜像
docker start $(docker ps -a -q)
# stop停止所有容器
docker stop $(docker ps -a -q)
# remove删除所有容器
docker rm $(docker ps -a -q)
# 删除所有镜像
docker rmi $(docker images -q)