Fun Docker Series II: Docker mirror deleted

introduction

Cloud container during the development process, we will make some mirroring locally to test validate the mirroring function. A long time local mirror server will be a lot, then we need to delete the image before the test, but we will encounter some problems in the process to remove the mirror, this article will elaborate on this theme.

  • 问题1:docker image is being used by stopped container
  • 问题2:image is referenced in multiple repositories

问题1:docker image is being used by stopped container

We use the docker rmi [image id]delete container mirror, but when prompted to delete the following:
Here Insert Picture Description
the corresponding mean to delete mirroring is a stop of container used, it can not delete the specified image.

Solution:

1, execute the command docker ps -a, meaning that the command is to look at all of the containers, including containers are not running.
By executing this command, you can see there is a reference to the container to stop the mirror, it can not be deleted;
Here Insert Picture Description
2, by docker rm [container id]deleting the stop after the container, and then execute docker rmi [image id]successfully delete the corresponding image.

问题2:image is referenced in multiple repositories

The following tips when you remove a mirror, the mirror is directed to multiple warehouses, can not be deleted.
Here Insert Picture Description
Solution:
Specifies the image name when deleting instead IMAGE ID. Such asdocker rmi service:2.0.0

Published 88 original articles · won praise 49 · Views 100,000 +

Guess you like

Origin blog.csdn.net/Diamond_Tao/article/details/103119450