After a system restart, it looks like the docker images which were existing are corrupted.
I tried the following-
I feel that removing the image will help. When I try removing, it seems to remove only the tag. It is not removing all the layers. How can I do this?
I tried docker rmi
. The image got removed.
Now, I try to pull the image again, some of the layers are already existing. I am trying to run the docker, it says oci runtime error ..... file not found
.
These images are working on other machines, and was working on this machine till some hours before.
Running docker images --no-trunc --format '{{. ID}}' | xargs docker rmi or docker volume prune -f will delete all of the images and their layers from the volume connected to your job.
Nothing. It simply ran flawless from the exact state it was before having its image deleted.
To clean this up, you can use the docker container prune command. By default, you are prompted to continue. To bypass the prompt, use the -f or --force flag. Other filtering expressions are available.
Warn :
Deleting some directories of /var/lib/docker/overlay2
may look appealing, may work but it is also risky. Indeed, it may create additional inconsistency/corrupted layers.
If you do that, please first make a full backup of folders that you want delete.
I did it two times in a production environment. The first time it worked, the second time it provoked a real mess (hard time and stress to fix that).
Since, I never did it again.
To fix issues with image pulling (layer not found or corrupted), here my tricks.
1 - If you may and want to wipe all your images and containers, you could do that.
Stop and remove all containers (running or not) :
docker rm $(docker stop $(docker ps -aq))
And in addition, use the system prune command :
docker system prune --volumes --all
to delete :
To skip the confirmation dialog, add the -f
flag.
It should solve corrupted layer issues since you restart from scratch.
2 - If it doesn't work (that is layers are still not found or corrupted), a possible strategy is ensuring that these failing layers are not used any longer during the pull.
To achieve that :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With