I am running a Python application in a Docker container. The application downloads files to container_dir in the container. I mount that container_dir to a host_dir on the host at runtime, e.g.
docker run ... --mount type=bind,source=host_dir,target=container_dir
The application running in the container will see files at container_dir and return that file path. However, the files get written to host_dir by virtue of the --mount instruction and so I would like the Python application to see (and report) the "de-referenced" host_dir instead of container_dir. Is that possible ? I'm thinking since Docker knows about the mount then applications running in the container should be able to know about it too.
I tried mounting to a Docker volume instead. I also tried --network=host in case that had some relation even though I did not think so.
TIA
Try to pass the
host_diras an env variable using the -e flag and use it as the basepath for your downloaded files instead ofcontainer_dir: