Docker Access External Files

I am wondering that docker has access to external files, however I do not want to include them as a volume. The files I need to access change over time, which means that I will need to re-mount it again.

If I am unable to install a simple directory and everything in that directory will also be installed.

I just need to allow a program placed in a container to run "on top" of my local system, where that program can access files on my local system.

Tips? Is there any other way besides adding files to be treated as a volume?

+3


source to share


3 answers


I solved the same problem with the below commands

docker run  --mount type=bind,source="$(pwd)"/data,target=/home/data -it <name_of_container>

      



Note. "-it conainter_name" should be the last flags.

+9


source


It looks like setting the host directory in the container is what you are looking for. You don't have to reload the container to get changes to the mounted directory. Link to relevant documents .



0


source


I wonder if the ADD team can help you achieve your goal. For example, given the line Dockerfile:

ADD /Users/userX/myappfiles /appfiles

      

and command line:

docker run myapp --input /myappfiles

      

myapp

will be able to access the /Users/userX/myappfiles

local file system to retrieve its entries.

0


source







All Articles