Multiple commands

This is the run.sh that I use to currently execute my code

letters=( "a" "b" "c" "d" )
for i in "${letters[@]}"
do
    python main.py $i &
done

This passes the letter into my main.py which I can then use.

How do I rewrite this in docker, considering I can only use on CMD command?

I think I should use docker-compose for this but I don’t know how

You could use the COPY instruction in your Dockerfie to copy run.sh into the image and use the ENTRYPOINT instruction (make sure to use the exec form!) to call it as entrypoint script.

1 Like