1
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 5 years have passed since last update.

docker rmi時に Error response from daemon: conflict: unable to remove repository reference

Last updated at Posted at 2020-05-09

docker rmi時に Errorが発生

$ docker rmi hello-world
Error response from daemon: conflict: unable to remove repository reference "hello-world" (must force) - container 545d5fe15767 is using its referenced image fce289e99eb9

docker ps だと何も残っているように見えないが、、

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

docker ps -aだと残っているコンテナが見えた。

$ docker ps -a
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS                       PORTS                                                          NAMES
545d5fe15767        hello-world               "/hello"                 8 days ago          Exited (0) 8 days ago                                                                       elated_einstein

残っているコンテナをdocker rm -f でコンテナを削除

$ docker rm -f 545d5fe15767
545d5fe15767

コンテナが削除できたことを確認

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

その後、docker rmiでイメージを削除できた。

$ docker rmi hello-world
Untagged: hello-world:latest
Untagged: hello-world@sha256:0e11c388b664df8a27a901dce21eb89f11d8292f7fca1b3e3c4321bf7897bffe
Deleted: sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e
Deleted: sha256:af0b15c8625bb1938f1d7b17081031f649fd14e6b233688eea3c5483994a66a3

備考

docker rmi -f (コンテナID) でも削除できるようだがなるべく避ける。
コンテナ削除できない場合は、docker stop (コンテナID) でまずコンテナを停止させる。

1
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
1
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?