Home > Software engineering >  run docker image with csv file
run docker image with csv file

Time:02-24

My question is simple, I know my question is duplicate but I couldn’t solve my problem basic I have a python image which I run with 3 arguments

like python app.py -s data -f test.csv -b 3

also, I have a docker image which I created like this

FROM python:3.9-slim-bullseye

COPY app /app/app
WORKDIR /app/app
RUN pip install --no-cache-dir -r requirements.txt

I tried to run like this

docker run --rm -it -v "$PWD":/data/ test_image python3 app.py -f data/test.csv -s data -b 3 but I am getting error FileNotFoundError: [Errno 2] No such file or directory: 'data/test.csv'

what am I doing wrong

CodePudding user response:

You are mounting you're volume to /data with "$PWD":/data/ but you are trying to access data/ relative to your current location because of the missing leading /. Meaning, that you look at /app/app/data/test.csv that doesn't exist.

You either can mount your local dir to a different place or adjust your command to something like app.py -f /data/test.csv

  • Related