0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Docker】 Dockerの定義が変わるたびにイメージを削除している人に試してもらいたいコマンド

Posted at

コマンド

docker-compose build --no-cache

なぜ

Dockerはイメージを削除しても同じDockerFileやdocker-compose.ymlでビルドする際に素早くビルドできるようにキャッシュを持っています。
キャッシュは以下のコマンドで見ることができます。

$ docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          0         0         0B        0B
Containers      0         0         0B        0B
Local Volumes   104       0         13.12GB   13.12GB (100%)
Build Cache     348       0         21.32GB   21.32GB

このキャッシュはDockerFileやdocker-compose.ymlの変更は見てくれますがそれ以下のレイヤーは見てくれません。
なので変更が反映されないということが起きます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?