简体   繁体   中英

How to fix docker container after deleting overlay2 folder

Folder docker/overlay2 was deleted, and now all my containers fall with error stat /var/lib/docker/overlay2/***: no such file or directory Is there any way to fix this without losing all container data?

Solution

$ docker rm $(docker ps -a -q)
$ docker rmi $(docker images -q)

docker system prune --all worked for me

Is there any way to fix this without losing all container data?

No, you've already lost your container data. All you have left now are pointers to where the data used to be. This is why I strongly recommend against deleting files from within this folder unless you plan to completely reset docker to an empty state. At this point, the cleanest thing to do is shutdown the docker engine, delete the rest of the files and directories from /var/lib/docker , and restart. If you have data in named volumes, you may wish to first save that folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM