arun kamboj
arun kamboj

Reputation: 1315

How to get project path using docker

I have an Ubuntu machine, on which I've installed my Sails.JS(Node.JS) project. I'm using docker on my Ubuntu machine, but unfortunately I'm not able to find the project location because it's using docker so I'm not able to get the exact project directory.

I've 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 contain my project's folder but I'm confused on which folder I can get my latest code.

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

Upvotes: 2

Views: 11021

Answers (1)

pl_rock
pl_rock

Reputation: 15792

You are searching files in your host machine which is showing your files in the docker volumes at /var/lib/docker.

You have to go inside docker then you need to search it.

  1. Get docker name or id by running command

    docker ps
    
    CONTAINER ID        IMAGE                  COMMAND             CREATED             STATUS              PORTS               NAMES
    aa6f45710063        mydockerimage   "/start.sh"         3 seconds ago       Up 3 seconds        1337/tcp            sailsjs_app
    
  2. go inside docker using command

    docker exec -it containername_or_ID /bin/bash
    
    example:
    docker exec -it aa6f45710063 /bin/bash
    
  3. Now your inside docker container. you can search your file in it.

    find . -name "*local.js*"
    
  4. once your work is done. You can exit from container by running command

    exit
    

Upvotes: 4

Related Questions