Recover Data Stopped Container Dev Env

  1. Hi Folks, got a BIG issue. Im using dev environment preview. I run a container which has been pushed to my private repo on docker hub. I use github for code. I dit commit but did NOT push my code. Container was stopped… Is there a way to retreive my code back somewhere? Regards!

I guess you already solved this by now?

Just in case: if you did not start the container with the --rm argument (to remove the container when stopping it), then the container should still be listed with:

docker container ls --all

How did you start it? Does it show with the command above?

No still searching. I did not rm the container. But im using the developer enviroment feature. Dont know if it makes a difference. I dont know the name of container its automaticaly generated when started.

I’ve no idea what “the developer environment feature” is. But how many containers show for docker container ls --all? If not too many, maybe you could try to re-run them all?

(Also, the output shows a CREATED column.)

I dont have much like 8. How would you suggest to run it? (im totaly green with docker)

You’d want an interactive shell to peek around. In Docker Desktop there’s a >_ (tooltip “CLI”) button for each container. On the command line, this may help:

docker container run -it <name> /bin/bash 

did take a look at each one… not there…

Did docker container list show any of them was created recently, and if yes: did you create any other containers yourself? In other words, just to be sure: did you know where to look for the code in the containers?

Ah, given your issue description in GitHub it’s a feature of Desktop.

Did you use Visual Studio Code? Then, maybe, that has some local history it keeps outside of the container? (I’ve no idea, but maybe worth searching for.)

Have all containers in the screenshot in that GitHub issue been created using this feature? And if yes: is any listed in the output of docker container ls --all?

Did you use Visual Studio Code? YES Then, maybe, that has some local history it keeps outside of the container? (I’ve no idea, but maybe worth searching for.)

Have all containers in the screenshot in that GitHub issue been created using this feature? YES And if yes: is any listed in the output of docker container ls --all? YES

If you have a stopped container that contains important data in your development environment, there are a few steps you can take to recover that data:

  1. Start the container: First, you’ll need to start the container that has the data you need. You can do this by running the command docker start <container_name> in your terminal, where <container_name> is the name of the stopped container.
  2. Copy the data: Once the container is running, you can copy the data you need from the container to your local machine. You can do this by running the command docker cp <container_name>:<container_path> <local_path>, where <container_name> is the name of the container, <container_path> is the path to the data you need inside the container, and <local_path> is the path where you want to copy the data to on your local machine.
  3. Stop the container: After you’ve copied the data you need, you can stop the container by running the command docker stop <container_name>.