This is the 8th day of my participation in the August More Text Challenge. For details, see:August is more challenging

preface

The problem

To solve

At the end

preface

With the increasing popularity of cloud native, docker containerization has become the improvement direction of many existing services. Docker has become popular rapidly with more efficient utilization of system resources, faster startup time, consistent operating environment, continuous payment and deployment, easier migration, easier maintenance and expansion, and other advantages. However, after many containers are deployed, there are various problems with recycling, such as the image deletion problem discussed today, sometimes the deletion operation will be unexplained error.

The problem

I encountered a problem today, when I tried to delete an expired image file, an error was reported inexplicably.

Below is a list of my images on the server. There are many expired images that need to be deleted. In theory, cleaning expired images should be a routine operation, but unexpectedly, there are many problems.

General operations are directly using the command docker mirror rmi ID to delete the corresponding image, but I encountered the following error:

The detailed error message is as follows:

Error response from daemon: conflict: unable to delete f73fe6298efc (cannot be forced) – image has dependent child images

To solve

Later, by looking up the data, found that deleting the mirror actually has a great mystery. In general, use the following method and progressive relationship to try to delete a mirror:

Method 1: Delete the command as follows:

Docker RMI image ID

If method 1 does not work, you can consider using method 2, the command is as follows:

Docker Rmi-f Image ID

If method 2 does not work, you can consider using method 3.

Docker RMI image repository name :tag

At ordinary times, we encountered in the work of all mirror deletion failure, will be basically enough to use these three boards.

Below is a screenshot of my successful deletion of the corresponding image:

At the end

To master the daily use method of Docker is a basic skill for the server development students. Hello, everyone, MY name is Liuzhen007, a Chinese bond who can tap code. Welcome to pay attention to me.

Calendar Punch in (August Challenge)