Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command in task definition causes exception

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.

enter image description here

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"

like image 789
Anthony Kong Avatar asked Mar 09 '23 18:03

Anthony Kong


1 Answers

I need to put the command as a comma delimited string i.e.

python,/app/src/main.py

like image 199
Anthony Kong Avatar answered Mar 11 '23 06:03

Anthony Kong