I'm currently trying to mount a Docker container directory to my local host directory. My local folder has the path C:/Users/lp/local_env-Returns/
and has the following files: cmi_forecast_script.py
, Dockerfile
, requirements.txt
, .dockerignore
and sales_data.xlsx
. I'm running the Python script when I run the Docker container of the Dockerfile. This creates a csv_file in my Docker container. The path of the csv_file in the container is /cmi_forecast_script/7789-10033.csv
. Now I want that I have the csv-file also in my local-directory. I already tried to mount the two paths with docker run -v /Users/lp/local_env-Returns/:/cmi_forecast_script/ <image name>
. But then I get: python: can't open file 'cmi_forecast_script.py': [Errno 2] No such file or directory
. Where is the problem?
PS: I also tried docker run -v /Users/lp/local_env-Returns/:/cmi_forecast_script/cmi_forecast_script.py <image name>
but then I get another error which is too long to post here.
My Dockerfile:
FROM python:3.8-slim-buster
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
COPY requirements.txt .
RUN pip install -r requirements.txt
WORKDIR /cmi_forecast_script
COPY . /cmi_forecast_script
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /cmi_forecast_script
USER appuser
CMD ["python", "cmi_forecast_script.py"]`