0

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)

Aidan Ewen
  • 13,049
  • 8
  • 63
  • 88
  • If your Dockerfile `COPY`d it into your image, the code should be in the same place. If you were running a bare `node` image and just bind-mounting your code in, it’s probably gone. Make sure to run your container without bind mounts if you think it is in the image. – David Maze Mar 04 '20 at 14:51

2 Answers2

1

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

Hope this help

cosmin_popescu
  • 186
  • 4
  • 16
  • Thanks, but I think I wasn't clear in my question - I didn't copy my files into the image. They were part of the build context. – Aidan Ewen Mar 04 '20 at 13:49
0

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/ .

admlz635
  • 1,001
  • 1
  • 9
  • 18
  • Thanks - code was part of the docker build context. I didn't copy it into the container. I'm hoping it's hidden in the container somewhere (its not anywhere obvious - I can't find it using the `find` command) – Aidan Ewen Mar 04 '20 at 13:22