I execute the docker(Docker version 19.03.1, build 74b1e89
) clean command in the server:
docker system prune
to my surprise, this command delete the container that stopped. That’s the problem, some container stopped by some reason but I still want to use it in the furture. Now it is deleted, is it possible to recover the mistaking deleted container that stopped?
2
Answers
No, it is not possible. You have to repull the image
docker pull image
, or rebuild the image.Docker images and containers are not the same. See this answer.
docker system prune
tells you:So it should be no surprise that it removed your container and possibly also the image it was based on (if no other container was running based on that same image).
I believe it is not possible to recover your image or container, however you can rebuild them. Depending on how the image was obtained you have to run:
After that you will have your image and you can run a container again with: