2

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

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

3 Comments

when I try to run the image my script doesn't recognize the path/files i pass as valid even though the files are in the containers work directory. Is there anyway to supply them with a correct path? i use argparse in my python script
Could you please open a new question with the command you are running and the errors that are thrown if any

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.