Search code examples
linuxdockerdirectoryfilesystemsls

I am not able to locate the files manually that I am getting from terminal "ls" output


I installed docker container from Githunb. It is working smoothly via run_docker.sh command. Everything is working as desired but I am not able to locate the input files present at directories mentioned in "run_docker.sh" script.

So I run the command as mentioned at Github page

(base) smtpn@smtpn-Nitro:~$ sudo docker run -it --rm --entrypoint bash shixiangwang/gistic

And then I use "ls" to check the files present in that directory

(base) root@3340d861afab:/opt/GISTIC# ls

The output list all directory, required to run docker. However, when I go to the directory /opt/ manually through nautilus or nemo file manager, I am not able to locate any directory/folder (hidden folder view is on) which I am getting from terminal output. How can I see the same list of folders which I am getting from the terminal output?

It is very strange and do not know why it is happening.

Any help will be appreciated.

Thank you


Solution

  • Containers are isolated from the host. Their filesystems are stored in internal Docker directories which you could locate for fun but shouldn't use to work with your containers.

    If you need to share files or directories between your host and a container, you can make use of bind mounts which will map a file/directory from your host to one of a container

    docker run -it --rm -v /home/smtpn:/some/dir/inside/container --entrypoint bash shixiangwang/gistic
    

    Notice the -v option: -v /home/smtpn:/some/dir/inside/container (which is a basic example as I don't know what you're doing). It maps the /home/smtpn directory from the host to the /some/dir/inside/container directory inside the container. You can do the same for files.

    I'm not sure that a volume will really solve your issues. If you need to make many changes to an image, you may also be interested in creating your own image by extending the actual one, by writing a Dockerfile.