Search code examples
amazon-web-servicesdockeramazon-ecsaws-batch

Docker executable not found in PATH when using AWS batch/ECS


I am trying to run a simple Dockerized Python script with AWS batch.

Is there a problem with my Docker image?

I have locally built the Docker image and it runs fine locally. I pushed the image to a AWS repository, and pulling this remote image to my local machine also runs correctly.

Problem

I have setup my compute env, job queue, and job definition, but I get this error

CannotStartContainerError: Error response from daemon: 
OCI runtime create failed: container_linux.go:370: 
starting container process caused: 
exec: "docker": executable file not found in $PATH: unknown

when I run

["docker","run","-t","111111111111.dkr.ecr.us-region-X.amazonaws.com/myimage:latest","python3","hello_world.py","--MSG","ok"]

Is Docker installed?

I am using the ECS_AL2 image type. When I start a EC2 with this AMI and ssh into it, I can see that Docker is already installed. docker run works fine for instance.

Is there a (generic) problem with my compute env, job queue, or job def?

When I instead try to run the command echo hello this works fine.

Appreciate any advice/help you can provide.

UPDATE - ANSWER

@samtoddler helped me to realize that I only needed

["python3","hello_world.py","--MSG","ok"]

in the Command statement


Solution

  • this error

    CannotStartContainerError: Error response from daemon:

    that means it is coming from docker daemon, so docker is doing its job.

    Seems like you have some trouble with your docker image, how it is packaged and how you trying to pass all those vars.

    Please check Docker Image CMD section on how to use ENTRYPOINT and CMD.

    There is some explanation in this question docker-oci-runtime-create-failed-container-linux-go349-starting-container-pro