Skip to content
Advertisement

Docker-Compose Output File To Local Host

I have the below docker-compose.yaml file that sets up a database and runs a python script

JavaScript

To run it I perform the following

JavaScript

Here is the Dockerfile

JavaScript

Now this works fine I can see the data has been properly populated under the generated in the msql database. The python file at the end of the script should dump a csv file to /app/ouput/output.csv (via pandas library df.to_csv("output/output.csv")) My question is, how to recover that csv from the container to the local directory. The script seems to finish off without any errors, but can’t find the output file at the end.

Advertisement

Answer

it seems using docker-compose run -v $(pwd)/output:/app/output py_service did the job

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement