Reputation: 40634
Originally in a Dockerfile
I use
CMD python /app/src/main.py
to start a process in my docker container. It works as expected.
I am now in the process of deploying these docker images to the aws ecs.
I want to move this CMD
out of the Dockerfile and put it as part of the task definition, because I suppose it will offer me more flexibility.
However when the docker container is spinned up, it emits this exception:
container_linux.go:247: starting container process caused "exec: \"python
/app/src/main.py\": stat python /app/src/main.py: no such file or directory"
Apparently ecs treats the CMD parameter as if it refers to a single file.
I have tried to define the command as a list i.e. ["python", " /app/src/main.py"]
but it just raised a different error: container_linux.go:247: starting container process caused "exec: \"[\\\"python\\\"\": executable file not found in $PATH"
Upvotes: 4
Views: 1894
Reputation: 3001
We are using Terraform, where the task definition was defined in JSON format. There, command is a JSON array, containing each part of the command as an element:
{
...,
"command" : ["python3", "/app/src/main.py"],
}
Upvotes: 0
Reputation: 40634
I need to put the command as a comma delimited string i.e.
python,/app/src/main.py
Upvotes: 7