My python script needs two arguments to run --manual, --ckl and an optional --output. manual and ckl are just files used as to create an output file. I use argparse in the script.
When i try to run docker run test --manual test.xml --ckl rhel7.ckl
I get this error
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "--manual": executable file not found in $PATH: unknown.
FROM python:3.10
WORKDIR /home/johnb
RUN pip install pandas
ADD manual_into_ckl.py .
#command to run
CMD [ "python", "manual_into_ckl.py"]
i'm new to this and im not sure how to configure the dockerfile correctly. I've tryed using the full path in the docker run command and that doesn't change anything
CodePudding user response:
If you want arguments to be passed to the container, then use ENTRYPOINT instruction in exec form instead of CMD in your Dockerfile.
FROM python:3.10
WORKDIR /home/johnb
RUN pip install pandas
ADD manual_into_ckl.py .
#command to run
ENTRYPOINT [ "python", "manual_into_ckl.py"]
Then run the container as
docker run test --manual test.xml --ckl rhel7.ckl
The additional arguments passed to docker run
will be passed as args to the entrypoint specified in the dockerfile. The resulting command would look like
python manual_into_ckl.py --manual test.xml --ckl rhel7.ckl