Home > Back-end >  Restore container after docker-destkop uninstall on Windows
Restore container after docker-destkop uninstall on Windows

Time:11-18

I met some issues with docker-desktop on Windows and performed a fresh install. The only problem is that my images and containers are gone...

I'm only interested to recover one specific container using TensorFlow, containing jupyter notebook that I should have save.

Is there any way to restore it?

CodePudding user response:

I'm sorry but you won't be able to restore it.

  • When you have Docker Desktop without WSL2 backend, the resources are stored under C:\ProgramData\docker and those are deleted at uninstall.
  • When you have Docker Desktop with WSL2 backend, the distribution where Docker is running is completely wiped out at uninstall.

I suppose you were using the official image under tensorflow/tensorflow (or the equivalent with GPU support), so next time don't forget to use a volume for those contents you'd like to persist or even better, have a disposable container that binds-mount your workspace.

Example:

  1. Create a folder under C: where you want your Jupyter Workspace, let's say C:\Projects
  2. Start the container by mounting that folder on the container and run Jupyter Notebook: docker run -it --rm -v C:\Projects:/usr/workspace -p 8888:8888 tensorflow/tensorflow:nightly-jupyter
  3. When you access to your Notebook in the browser (under localhost:8888), open in Jupyter Notebook the directory /usr/workspace, so all the work you're doing will be also stored in the host in C:\Projects
  4. When you finish, you can safely stop and delete your container, since the work is stored in the host and not only in the container.
  • Related