I have a python script python_fun.py
and going to prepare a docker file for it, the code needs a directory and a url for downloading some data. I am wondering how I can pass the url path. According to this question I designed the docker as below:
in the python_fun.py
I have:
def do_somthing(url, dir_path):
#do something!
if __name__=="__main__":
dir_path = sys.argv[1]
url = sys.argv[2]
do_somthing(url, dir_path)
I made a shell script as below
#!/bin/bash
while getopts 'i' OPTION; do
case $OPTION in
i) dir_pth=$OPTARG;;
esac
done
python python_fun.py $4 $dir_pth
In the dockerfile I call the bash script as below:
RUN bash test.sh -i /module/testdata/results/
and am going to build and run the docker using the below commands:
docker build -t myaccount/docker_name:latest .
But it gives me list index out of range
issue in the python script, any idea to fix it?