I have a python app running on a docker container and it generates a pdf file. I want to store the generated pdf file in a given path in the host machine.
I am not sure on how can this be achieved. Any ideas?
Mount a volume in your container mapped to the desired path in your host
docker run -d -v /host/path:/python_app/output your_docker_image
Where /python_app/output
is the path inside the container where your app is writing the pdf file.
Note that /host/path
should have enough permissions
chmod 777 /host/path
Use volumes to mount directory in a container to host director:
docker run -v /MY/HOST_DIR:/MY/CONTAINER_DIR
Your pdf file will be stored in /MY/HOST_DIR on host.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With