Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

updated at


Dockerで none なイメージを一括で削除するワンライナー

docker pullを何回も叩いていると、ローカルのイメージが<none>になってしまうことがあります。

$ docker images
REPOSITORY             TAG                          IMAGE ID            CREATED             VIRTUAL SIZE
node                   latest                       6d123ea65021        2 weeks ago         706.5 MB
centos                 latest                       2b8d6139a545        2 weeks ago         212.1 MB
postgres               latest                       dcce0da1c311        2 weeks ago         213.9 MB
mysql                  latest                       97454fa6c9d3        2 weeks ago         282.8 MB
<none>                 <none>                       9552b2f0723b        2 weeks ago         255.7 MB
debian                 latest                       1265e16d0c28        2 weeks ago         84.98 MB



-f(フィルタ)オプションを使うと イメージを抽出することができます。

docker images -f "dangling=true"


docker rmi $(docker images -f "dangling=true" -q)



docker image prune
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Help us understand the problem. What are the problem?