简体   繁体   中英

docker python app reading files from network share folder

I deployed a python 3 app to a docker container and it is failing due to the following:

The app reads files from windows network share drive for processing. The app runs fine when I run it from my windows machine, where I have access to the share drive.

In the remote Linux docker container, the app fails because it can't see the shared folder.

I would appreciate any advise or example on how to make the share drive visible to the docker container. Right now, in the python code, I point to the share using the os package .... example: os.listdir(path) where path is

\\\\\\myshare.abc.com\\myfolder

You need to mount shared storage inside docker container to access it. Mount volumes like in docker run command:

docker run –volume-driver=nfs -v server/dir:/path/to/mount/point ...

where server/dir represents shared path and rest is path accessible inside container Read more about volumes: https://docs.docker.com/storage/volumes/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM