Scene:
Want to load an image on the server for packaging other service images using Dockerfile.
Problem description
I loaded a mirror in docker, but after a while, the mirror disappeared. The mirror disappears automatically.
What I load here is an openjdk image.
Load using the following command
# gunzip -c | docker load
After completion, through query, you can see that the image exists.
# docker images |grep openjdk
At this time, I immediately use Dockerfile docker build -t to create a mirror package for the service I want to use. You can also create the corresponding mirror.
After a while, I found that the openjdk image that loaded was gone. The newly-printed mirror also disappeared.
Cause analysis:
Here are the reasons I found through Du Niang, and I gave a few reasons:
1. Disk Space Management: When the host disk space is insufficient, the Docker daemon may automatically delete images that are no longer in use to free up space based on its internal garbage collection policy. This usually affects images that are not referenced by any container.
2. Manual or automatic cleaning: the user or system administrator may have executed docker system prune, docker image
Commands such as prune to clean up unused images, which will delete all dangling (orphaned) images or filter out no longer needed images according to specified conditions and delete them.
3. Repository Problem: If the image is pulled from a remote repository (such as Docker Hub or private repository), and the image in the repository is later deleted or is inaccessible due to network reasons, the image referenced locally through the tag may not be pulled and used normally, and it looks like it has disappeared.
4. Configuration error or software failure: In some cases, due to Docker's own configuration error, software bug, or conflicts with other system services, the image list may not be displayed correctly or the image file is lost.
5. System failure or restart: Although not common, if a failure occurs at the operating system level, such as abnormal shutdown or hardware failure, it may cause the Docker image data stored on the local disk to be damaged or lost.
6. Unexpected operation: If an error operation is directly deleted, the image will also cause the image to appear to "disappear".
Judging from my actual situation here, it is likely that the docker data volume is insufficient to allocate space.
Solution:
Because docker's garbage collection strategy is just to recycle unused images, I've simply processed it here. After the image is generated, docker run it directly so that it won't be cleaned up.
Of course, this is just an emergency treatment.
The correct way to do this is to increase disk space.
Or disable docker image prune automation tasks: If you have previously set up a timed task or cron job to run docker system prune or other cleaning commands, you can cancel these tasks.
Or increase the size of Docker data volume: If you are using a virtual machine environment, you can consider increasing the size of the data volume allocated to Docker.
This is the article about the problem of the disappearance of docker images and temporary solutions. For more related content on the disappearance of docker images, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!