amazon-web-servicesdockeramazon-elastic-beanstalkaws-ecr

AWS Elastic Beanstalk Docker From ECR Error "No Docker image specified in Dockerrun.aws.json"


I'm attempting to deploy a docker image from AWS ECR to Elastic Beanstalk. I've set up all required permissions for Elastic Beanstalk to both S3 and ECR. Communication between these services seems fine, however I get the following errors when attempting to fire up an Elastic Beanstalk environment:

  1. No Docker image specified in either Dockerfile or Dockerrun.aws.json. Abort deployment.
  2. [Instance: i-01cf0bac1863e4eda] Command failed on instance. Return code: 1 Output: No Docker image specified in either Dockerfile or Dockerrun.aws.json. Abort deployment. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03build.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

I'm uploading a single Dockerrun.aws.json which points to the image on ECR. Below is my Dockerrun.aws.json file:

{
  "AWSEBDockerrunVersion": "1",
  "containerDefinitions": {
    "Name": "***.eu-central-1.amazonaws.com/***:latest",
    "Update": "true"
  },
  "Ports": [
    {
      "ContainerPort": "5000"
    }
  ],
  "Logging": "/var/log/nginx"
}

The docker image does exist on ECR at the location specified in the containerDefinitions Name field.

Am I missing something here?


Solution

  • Turns out containerDefinitions is not applicable in this situation. I'm not sure where I found it (maybe from a dockerrun sample somewhere). The actual property name is as below:

    {
      "AWSEBDockerrunVersion": "1",
      "Image": {
        "Name": "***.eu-central-1.amazonaws.com/***:latest",
        "Update": "true"
      },
      "Ports": [
        {
          "ContainerPort": "5000"
        }
      ],
      "Logging": "/var/log/nginx"
    }