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

タグの付いていないDockerイメージ を削除する - docker image TAG <none>

More than 1 year has passed since last update.

Docker を使っていると DockerイメージがMacの容量を圧迫するので、削除コマンドをメモ。

コンテナが使っていないイメージをすべて削除する

$ docker imagesとコマンド叩いて存在するDockerイメージの一覧を出すことができるので確認。
$ docker rmi $(docker images -q)を実行して削除。

タグの付いていないDockerイメージを削除する

タグのついていないDockerイメージの一覧表示

$ docker images --filter "dangling=true"
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              fd68d72b1116        2 weeks ago         1.5GB
<none>              <none>              20d99ba920ac        3 weeks ago         1.49GB
<none>              <none>              0e3710ea2df9        4 weeks ago         1.49GB

削除実行

$ docker rmi $(docker images -f "dangling=true" -q)
Deleted: sha256:fd68d72b11164cd8c4d9850f722458ee0ee88f7b84e3e818f36fdb232a2e5000
Deleted: sha256:6387313607add33197e7fe7e570bb0481e752ad46b68a36c24cce638d91ade00
Deleted: sha256:20d99ba920acc7c5321c4cb8c251fc39115338e7c4659c02e366c297a73abebc
Deleted: sha256:5fa9b01bf1ea0dbe4cd43f09f7781a43db0d3c5f0376b21561292c005b839a24
Deleted: sha256:c8f469aee63ba89ca95a397769db5924afce60088f80e37f1d139f26d514118b
Deleted: sha256:5ec98679890f97f09150d2f79be3f0ff90760838932c7f2a26746967c965ca4b
Deleted: sha256:fb5f366a2d87a13555089bfad0d8073db70a5ea91047f32736bd8acfa0e3bd39
Deleted: sha256:13ed1d1b8e9880dd85c6ce3d627877e9ee5218211cfe08a634a1f0cab6c2795a

これで完了。

<追記>

Docker volumeの削除

$ docker volume rm -f $(docker volume ls -q)

定期的な削除をお勧めします。
(※いつの間にかDocker for Mac にLocalのストレージを40GBも圧迫されていました。笑)

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
No 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
ユーザーは見つかりませんでした