Aidan Ewen
Aidan Ewen

Reputation: 13308

Retrieve my codebase from within a docker image context

I've just deleted my repository. Worse than that - I've had issues with Bitbucket and haven't pushed it up for weeks. It should be backed up in iCloud, but iCloud is failing (the iCloud page in the browser keeps telling me its down for maintenance).

I've got a few docker images I was using for deployment. The codebase is included in the context of the image.

Can I get it back from these images if I spin up the image in a container? And if so where is it?

Just to clarify - the code was part of the build context

docker build -t node .

I didn't copy the code into the container in a docker file

(If anyone is interested I was clearing the dist directory before deploying and I made a typo my command was rm -rf $(pwd) dist/* rather than rm -rf $(pwd)/dist/* - the problem was, I as in the root of the repository, and which was a mounted volume from my laptop)

Upvotes: 0

Views: 826

Answers (2)

admlz635
admlz635

Reputation: 1014

If the code is within the image, you could run a container and do a cp, like

docker cp DEVELOP_CONTAINER:/src/ /home/aiden/src

https://docs.docker.com/engine/reference/commandline/cp/ .

Upvotes: 0

cosmin_popescu
cosmin_popescu

Reputation: 196

Maybe you can try to explore the image filesystem. As far as I know, even Visual Studio Code can do this.

Hope this help

Upvotes: 1

Related Questions