Docker Community Forums

Share and learn in the Docker community.

Save file running on a docker container to local desktop

I built a microsite that pulls data from a SQL database and saves it to a computers desktop. The code uses is a simple python line, df.to_csv(/Users/bennicholl/Desktop/newdataframe.csv) When I dockerized this app and try running it, I get an error, IOError: [Errno 2] No such file or directory: u'/Users/bennicholl/Desktop/newdataframe.csv' I’m assuming I need to start the path with wherever docker is running the Dockerfile from, but I can’t figure out how to set the path, or even where to find it. I have copied my Dockerfile code below. Let me know if anything else is needed to solve this issue. Thanks!

FROM ubuntu:16.04

MAINTAINER Ben "jawn@jawn.com"

RUN apt-get update -y &&
apt-get install -y python-pip python-dev

COPY ./requirements.txt /app/requirements.txt

WORKDIR /app

RUN pip install -r requirements.txt

COPY . /app

ENTRYPOINT [ “python” ]

CMD [ “engagement_calc.py” ]

hey @bnicholl66 if you want to save the db data to that path only
why not you use volume mount(https://docs.docker.com/storage/volumes/)
mount the path in container and save the data on the mount location that will be save on path on the host.