[英]run docker image with csv file
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我的问题很简单,我知道我的问题是重复的,但我无法解决我的基本问题我有一个 python 图像,我用 3 arguments 运行
like python app.py -s data -f test.csv -b 3
像python app.py -s data -f test.csv -b 3
also, I have a docker image which I created like this另外,我有一个 docker 图像,我是这样创建的
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'
docker run --rm -it -v "$PWD":/data/ test_image python3 app.py -f data/test.csv -s data -b 3
但我收到错误FileNotFoundError: [Errno 2] No such file or directory: 'data/test.csv'
what am I doing wrong我究竟做错了什么
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 /
.您正在使用"$PWD":/data/
将卷安装到/data
,但由于缺少前导/
,您正在尝试访问相对于当前位置的data/
/ 。 Meaning, that you look at /app/app/data/test.csv
that doesn't exist.意思是,您查看不存在的/app/app/data/test.csv
。
You either can mount your local dir to a different place or adjust your command to something like app.py -f /data/test.csv
您可以将本地目录挂载到其他位置,也可以将命令调整为app.py -f /data/test.csv
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.