I want to pass argument to python file app.py while running its docker image using command :
docker run -d -p 5000:5000 python_app https://github.com/abc/repo
where python_app is image of my application and https://github.com/abc/repo is the argument which I want to pass. But when I run docker image using above command my container exits with error :No such directory or file found
This is my Dockerfile
FROM python:2.7.13
MAINTAINER xyz "[email protected]"
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["app.py","https://github.com/abc/repo"]
I think my param2 in CMD is treated an argument for docker image rather than argument for python application.
td;lr use ENTRYPOINT ["python", "app.py"] then you can pass parameters to the docker run
see answer here: how to pass command line arguments to a python script running in docker td
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With