Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method to solve the problem that Docker Image image cannot be deleted

Shulou Source: shulou.com Published: 2022-06-02 02:20:54 10月02日 Update

Preface

Docker is an open source container engine project based on lightweight virtualization technology from Docker.Inc. The whole project is developed in Go language and conforms to the Apache 2.0 protocol. Through hierarchical image standardization and kernel virtualization technology, Docker enables application developers and operation engineers to publish applications across platforms in a unified way, and to provide a resource-isolated application running environment with almost no additional overhead. Due to many novel features and the openness of the project itself, Docker has quickly won the participation of many IT manufacturers in less than two years, including Google, Microsoft, VMware and other industry leaders. At the same time, Docker has stirred up thousands of waves in the developer community, and many programmers like me have begun to pay attention to, learn and use Docker. Many enterprises, especially Internet enterprises, are also increasing their investment in Docker, which has the potential to set off a container revolution.

Problem found:

Image is one of the core technologies of Docker, and it is also the standard format for application publishing. Recently, I have encountered a problem in my work, which is as follows:

Error response from daemon: conflict: unable to delete 4ac2d12f10cd (must be forced)-image is referenced in multiple repositories

Error response from daemon: conflict: unable to delete 4ac2d12f10cd (must be enforced)-image referenced in multiple repositories

1. Delete Mirror

View Mirror

Root@souyunku:~/mydocker# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEnginx v1 4ac2d12f10cd 41 minutes ago 108MBsouyunku/nginx v1 4ac2d12f10cd 41 minutes ago 108MBhello-world latest f2a91732366c 5 weeks ago 1.85kB

Delete failed

Delete one of the images, which has 1 repo reference and is not used by the container

And there are no containers to use

Root@souyunku:~/mydocker# docker container ls-aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES4c104074b3f4 hello-world "/ hello" About an hour ago Exited (0) About an hour ago priceless_hawking

The image has 1 repo reference

Root@souyunku:~/mydocker# docker rmi 4acError response from daemon: conflict: unable to delete 4ac2d12f10cd (must be forced)-image is referenced in multiple repositories

two。 Solution method

Delete REPOSITORY

For the deleted ImageID, there is a REPOSITORY name reference. The solution is as follows:

That is, you specify a name instead of IMAGE ID when you delete it.

Root@souyunku:~/mydocker# docker rmi souyunku/nginx:v1Untagged: souyunku/nginx:v1

Then delete the IMAGE ID:

Root@souyunku:~/mydocker# docker rmi 4acUntagged: nginx:v1Deleted: sha256:4ac2d12f10cdb99c099749432b7a450ee1c6958e0f2f964cd64c6b086ba3e622Deleted: sha256:346164f732e08d72d1f64828acda4e5ca93f79473f443ce57d9cfe69d9b66b24Deleted: sha256:3f8a4339aadda5897b744682f5f774dc69991a81af8d715d37a616bb4c99edf5Deleted: sha256:bb528503f6f01b70cd8de94372e1e3196fad3b28da2f69b105e95934263b0487Deleted: sha256:410204d28a96d436e31842a740ad0c827f845d22e06f3b1ff19c3b22706c3ed4Deleted: sha256:2ec5c0a4cb57c0af7c16ceda0b0a87a54f01f027ed33836a5669ca266cafe97a

3. View Mirror

Root@souyunku:~/mydocker# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEhello-world latest f2a91732366c 5 weeks ago 1.85kB

Summary

The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.

Tags: Mirror container application problem technology project learning development method enterprise content developer standard work novelty one stone stirs up a thousand waves constantly industry kernel preface Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MariaDB vpn Redmi Microsoft