0

I am deploying my node app on AWS ElasticBeanstalk using the multidocker option. The app appears to deploy successfully, however, I notice that the app (inside my docker) is not actually running.

When I docker inspect <container_id> the running container, see that "Cmd": null. If I inspect the ECS task definition created by beanstalk, I also see "command": null"/

However, if I run the container manually (via docker run -d myimage:latest), I see "Cmd": ["node", "server.js"] and the application serves correctly. This is the correct CMD that is included inside my Dockerfile.

How come my ECS task definition does not read the CMD from my docker image correctly? Am I suppose to add a command to my Dockerrun.aws.json? I couldn't find any documentation for this.

Dockerrun.aws.json:

{
  "AWSEBDockerrunVersion": 2,
  "volumes": [
    {
      "name": "node-app",
      "host": {
        "sourcePath": "/var/app/current/node-app"
      }
    }
  ],
  "containerDefinitions": [
    {
      "name": "node-app",
      "image": "1234565.dkr.ecr.us-east-1.amazonaws.com/my-node-app:testing",
      "essential": true,
      "memory": 128,
      "portMappings": [
        {
          "hostPort": 3000,
          "containerPort": 3000
        }
      ]
    }
  ]
}
Brett
  • 11,637
  • 34
  • 127
  • 213
  • Seeing your Dockerfile would probably help. I have multiple docker containers running within AWS Beanstalk, and have never come across this issue. The CMD in the Dockerfile should be picked up and started once the container is deployed. – Rick Baker Oct 18 '17 at 13:09

1 Answers1

0

I have the same issue. For me, it turned out that the entrypoint did take care of running the command. However the issue remains, but it might be interesting to see what your entrypoint looks like when you inspect the image and when you inspect the container.

See also: What is the difference between CMD and ENTRYPOINT in a Dockerfile?

markus-hinsche
  • 1,372
  • 15
  • 26