In your Docker run command, you can mount one folder locally to a directory within your Docker container using the bind type.
For example, if you wanted to run a Jupyter Notebook Server in Docker you could use the command:
docker run -it --mount type=bind,source="$(pwd)/generatedDataLocal",target="/generatedDataInDocker" -p 10000:8888 jupyter/scipy-notebook:2023-02-28
Where source=$(pwd)/generatedDataLocal specifies your host computer in the current directory where the docker command is being run and /generatedDataLocal is simply a sub-directory under it, and target="/generatedDataInDocker" specifies a /generatedDataInDocker directory created inside the Docker container.
Files you create or modify in the /generatedDataInDocker directory of the Docker container will be automatically accessible in your local $(pwd)/generatedDataLocal directory. Conversely, if you add a file for example to the local $(pwd)/generatedDataLocal directory, it is accessible within the /generatedDataInDocker directory of the Docker container.
If you are generating a STATA file from a Pandas dataframe within your Jupyter Notebook, for example:
df.to_stata('/generatedDataInDocker/myStataFileEx1.dta', version=118)
..the myStataFileEx1.dta file would be available locally from within the generatedDataLocal directory (outside of the Docker container).
--outputoptionDOCKER_BUILDKIT=1 docker build -f Dockerfile --target=testresult --output outgithub.com/moby/buildkit#local-directoryDOCKER_BUILDKIT=1is an environment setting - to use buildkit as the build engine you must haveDOCKER_BUILDKITset to1. More info on Docker's website: docs.docker.com/engine/reference/builder/#buildkitvolumessection ofdocker-compose.ymlended up working great for me:- ./srv/reports:/srv/reports:delegated