Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
224 views
in Technique[技术] by (71.8m points)

volume - Having Docker access External files

I am interested in having Docker have access to external files, but I do not wish to include them as a volume. The files that I need access to will change over time, and this means I would need to re-mount repeatedly, unless I can mount a mere directory, and whatever is in that directory is also mounted.

I am just in need of allowing a software program pushed into a container, to run "over" my local system, where this software program has access to files on my local system.

Advice? Is there another way besides adding the files needing to be processed as a volume?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I solved the same problem with 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...