Delete none image in docker

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
Insert image description here
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 imagesdocker images | grep none
  • Query the IDs of all none imagesdocker images | grep none | awk '{print $3}'
  • Delete all none imagesdocker 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)

Reference
https://blog.csdn.net/web18484626332/article/details/126642211?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522169562824216800211559387%2522%252C%252 2scm%2522%253A%252220140713.130102334.pc%255Fblog. %2522%257D&request_id=169562824216800211559387&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2 blog first_rank_ecpm_v1~rank_v31_ecpm-1-126642211-null-null.nonecase&utm_term =docker%20%20%20%E7%A7%BB%E9 %99%A4%20%20none&spm=1018.2226.3001.4450

Guess you like

Origin blog.csdn.net/weixin_42990464/article/details/133274987