Since I usually use the docker build command to generate an image, sometimes due to frequent code updates, a lot of none images will be generated. Recently, I want to clear them out. So I wrote the following script: docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker stop docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker rm docker images|grep none|awk '{print $3 }'|xargs docker rmi Supplement: Docker deletes all none images or stopped containers After repeated builds in docker, many none images will remain. The following command deletes all none images in one click. docker rmi `docker images | grep '<none>' | awk '{print $3}'` A simpler way docker rmi `docker images -q -f dangling=true` or docker rmi $(docker images -q -f dangling=true) Remove all stopped containers docker rm $(docker ps -a -q) The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: Abbreviation of HTML DOCTYPE
>>: js array fill() filling method
1. Simulate database data 1-1 Create database and...
Table of contents 1. Original value and reference...
<br />From the launch of NetEase's new h...
1. Parent components can pass data to child compo...
How Nginx works Nginx consists of a core and modu...
This is what happened. Today I was playing with G...
Effect screenshots: Implementation code: Copy code...
This article example shares the specific code of ...
There is no mysql by default in the yum source of...
Simply pull the image, create a container and run...
Data Type: The basic rules that define what data ...
Purpose Understand the Nginx ngx_http_limit_conn_...
This article shares the specific code of JavaScri...
Table of contents How to display SQL log? ? Descr...
Overview What is harbor? The English word means: ...