Help us understand the problem. What is going on with this article?

Dockerで<none>のイメージを削除する

不要なnoneのイメージを削除する

dockerで同じ名前のイメージを作り直した際に古いほうのイメージがnoneになってしまったので、そのnoneを削除する方法について

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
docker-whale        latest              03e697003e07        About a minute ago   278MB
<none>              <none>              021059f3393e        4 minutes ago        278MB

とりあえずIDがnoneのリポジトリを抽出

$ docker images -f dangling=true
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              021059f3393e        About an hour ago   278MB

以下のコマンドでを削除しようとしてみたところ、

$ docker rmi $(docker images -f dangling=true -q)
Error response from daemon: conflict: unable to delete 021059f3393e (must be forced) - image is being used by stopped container 1ef4720be2f0

このようなメッセージが。
これを解決するためにfオプションをつけることによって強制削除!

$ docker rmi 021059f3393e -f

補足

$ docker rmi `docker images -aq`

こちらのコマンドで使用していないイメージの一括削除が可能

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
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  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