My goal is to run a python script, which is passed to a docker container containing source code and dependencies. This is to be run using Azure container instances (ACI). On my home machine I can do this in docker (setting ENTRYPOINT or CMD to "python") with
docker run myimage "myscript.py"
provided I spin up the container from a directory containing myscript.py
.
After some reading I thought a similar thing could be achieved on azure using az container create --command-line
as indicated here. My container creation would be something like
az container create \
--resource-group myResourceGroup \
--name my-container \
--image myimage:latest \
--restart-policy Never \
--command-line "python 'myscript.py'"
However the container is unable to find myscript.py
. I am using the Azure Cloud Shell. I have tried spinning up the container from a directory containing myscript.py
, and I have also tried adding a file share with myscript.py
inside. In both cases I get the error
python3: can't open file 'myscript.py': [Errno 2] No such file or directory
I think I simply do not understand the containers and how they interact with the host directory structure on azure. Can anyone provide some suggestions or pointers to resources?