I have an Ubuntu machine, on which I have installed my sails js(node js) project. I am using Docker on an Ubuntu machine. But unfortunately I am not able to find the project location. As it's using Docker we are not able to get the exact project directory.

I tried to use the following command

sudo find . -name "*local.js*"

It shows me that file inside the Docker directory. But there are lots of folders starting with some random alphanumeric text. All these folders containing my project's folder but I am confused, on which folder I can get my latest code.

Can anybody help me to locate the directory structure for my project?


Dealing with the "blobs" directories in /var/lib/docker is fraught with peril.

To see the contents of a docker container, the best way is to run a shell in it (if your docker image contains an executable shell):

docker run --rm -it --entrypoint /bin/sh <your_image>

If the container is already running you can instead do:

docker exec -it --entrypoint /bin/sh <your_image>

Then you have an interactive shell running in the container and you can use it to explore files (ls, cat, etc...)

Remember also that you can derive the container image to create another image in which you add other commands (or declare volumes to copy things outside the container for inspection).

If you want to inspect the container filesystem at your leisure you can export everything as a.tar:

docker export -o <the_output.tar> <container_name_or_id>

But the result can be unwieldy if you start from a large image (Ubuntu, Centos...)

For something smaller, you just run tar inside the container with its output to stdout, and redirect (outside the container) the output to a TAR file:

docker run --rm --entrypoint "" container/image tar -c /the/directory >dump_of_the_directory.tar

In slo-mo:

  • run: start the container
  • --rm: cleanup
  • --entrypoint "": reset the entry point to a default shell (useful if the container defines its entry point to start a Java runtime, for instance
  • container/image: the name of the image to start
  • tar -c /the/directory ask the container to TAR the directory of interest to its standard output (no -f). The output of the container is therefore the TAR contents
  • >dump_of_the_directory.tar: capture this stdout in the host and move ot to a TAR file

You can use a similar technique on a running container with docker exec instead of docker run.

  • i run the "docker exec -it containername_or_ID /bin/bash" command and able to view my project there. Can you please give some idea to get this project on my local Linux machine – arun kamboj Sep 11 '18 at 9:13
  • See edited answers – xenoid Sep 11 '18 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.