Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

Docker noneイメージの削除

More than 1 year has passed since last update.

noneイメージを表示する

docker images --filter "dangling=true"

noneイメージを削除する1

docker rmi $(docker images -f "dangling=true" -q)
  • -qはイメージIDのみ表示

noneイメージを削除する2

  • 1のコマンドだとnoneイメージがない場合、"docker rmi" requires at least 1 argument.となる
  • シェルスクリプト 等で上記が困る場合とか
docker images -f "dangling=true" -q | xargs --no-run-if-empty docker rmi
  • --no-run-if-empty
    • 引数が無い場合には、コマンドを実行しない

参考

hiro9
ガンバルンバ
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