2

After a restart of VM I was not able to run any docker command. I follow some question on stack overflow and run the following command ps axf | grep docker | grep -v grep | awk '{print "kill -9 " $1}' | sudo sh Now There is no image or container. Result of commands

docker ps and ps -a

docker images list 

docker ls  

docker ls -a 

All the command return empty list. Everything has been clean up. Is there any way to find our backups or restore the deleted containers?

  • What happens when you run `docker ps -a` -- do you get an error, or do you get empty output? It looks like you probably killed the docker daemon itself (because `ps axf | grep docker` would have matched `dockerd`), which would result in errors, and the solution would be to restart docker (typically `systemctl start docker`). – larsks May 31 '22 at 12:49
  • When I run docker ps -a It show me the heading of CONTAINER ID IMAGES COMMAND CREATED etc, no error – LoverBoy3694 May 31 '22 at 12:56
  • In the volumes folder I have only one file called metadata.db noting else. – LoverBoy3694 May 31 '22 at 12:57
  • You should be able to `docker pull` or `docker build` your images, and then `docker run` them again with the same commands as originally. If your setup is based on Compose then `docker-compose up` should recreate everything as it was before. – David Maze May 31 '22 at 13:20
  • I dont have docker-compose file also I cant use docker pull as docker hub is not connected. The aim is to restore the images with datbase . These images were created by my seniour and I distory his work. The whole VM is empty now. I only found some folder with long names at location /var/lib/ docker/ overlay2/ – LoverBoy3694 May 31 '22 at 13:26

1 Answers1

1

If the Docker ps and Docker ps -a command do not return anything it means all of your containers are lost. not sure how but the above command should not delete everything. Now it's a hard job to get all of your data back. Check if you have any volumes available and try to identify which volumes are for what is contained also check the available images. If you found nothing it means you have lost everything and ask to look for backups. However, if you have image volumes then recreate the container by using the old volumes it will build the new container with old data. This question will help you to find the correct volume for the correct container.