Rabin Limbu
Rabin Limbu

Reputation: 55

Elastic Beanstalk with Docker running on 64bit Amazon Linux 2/3.2.2 and Dockerrun.aws.json v3

Could somebody please point me to the correct Dockerrun.aws.json v3 documentation. I have done google many times and unable to find this v3 documentation.

I am trying to do multi-container deployment to elastic beanstalk with Docker running on 64bit Amazon Linux 2/3.2.2 but unsuccessful so far.

So far I am using Dockerrun.aws.json v2 format which seems to not work with this docker platform.

{
  "AWSEBDockerrunVersion": 2,
  "containerDefinitions": [
    {
    "name": "simple-ui",
      "image": "my-image-located-in-ECR",
      "essential": true,
      "memory": 128,
      "portMappings": [
        {
          "hostPort": 80,
          "containerPort": 3000
        }
      ],
      "command": ["npm","start"]
    }
  ]
}

Below is the error I am seeing in EB logs:

2020/12/09 18:55:34.954345 [ERROR] An error occurred during execution of command [app-deploy] - [Docker Specific Build Application]. Stop running the command. Error: parse Dockerrun.aws.json file failed with error json: invalid use of ,string struct tag, trying to unmarshal unquoted value into int

2020/12/09 18:55:34.954356 [INFO] Executing cleanup logic 2020/12/09 18:55:34.954437 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment: 'Dockerrun.aws.json' in your source bundle specifies an unsupported version. Elastic Beanstalk only supports version 1 for non compose app and version 3 for compose app. The deployment failed.","timestamp":1607540134,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1607540134,"severity":"ERROR"}]}]}

Thank you for your help in advance. Rabin

Upvotes: 5

Views: 7027

Answers (5)

dodov
dodov

Reputation: 5854

In my case, the issue was that the version number was specified as a number, rather than as a string. In other words, I had this:

"AWSEBDockerrunVersion": 1

…instead of this:

"AWSEBDockerrunVersion": "1"

As you can see in the docs, they specify it as a string there. Here's the example they give:

{
  "AWSEBDockerrunVersion": "1",
  "Image": {
    "Name": "janedoe/image",
    "Update": "true"
  },
  "Ports": [
    {
      "ContainerPort": "1234"
    }
  ],
  "Volumes": [
    {
      "HostDirectory": "/var/app/mydb",
      "ContainerDirectory": "/etc/mysql"
    }
  ],
  "Logging": "/var/log/nginx",
  "Entrypoint": "/app/bin/myapp",
  "Command": "--argument"
}

Upvotes: 0

Yuki SHIDA
Yuki SHIDA

Reputation: 31

I had exactly the same worries. I changed the value of "AWSEBDockerrunVersion" in "Dockerrun.aws.json" of version 1 to "3" and then deployed it.

Then, strangely, the following message was displayed.

Instance deployment: 'Dockerrun.aws.json' in your source bundle specifies an unsupported version. Elastic Beanstalk only supports version 1 for non compose app and version 3 for compose app. The deployment failed.

This means that you can just use version 1 of json for Amazon Linux 2 AMIs.

Upvotes: 0

tim
tim

Reputation: 126

With 64bit Amazon Linux 2 for multi container setups it's very important to make sure the elasticbeanstalk buildspec.yml has these two file artifacts

artifacts:
    files: 
      - 'Dockerrun.aws.json'
      - 'docker-compose.yml'`

You can verify that the file is within the source by going to:

Elastic Beanstalk > Applications > { application name } > Application versions

and then clicking on the source of the latest application to download the folder.

I was only sending the Dockerrun.aws.json to EBS and then thus wondering why I got the same v1 v3 error you got. In hindsight this make a lot of sense that the docker-compose.yml is needed.

Upvotes: 0

Mark At Ramp51
Mark At Ramp51

Reputation: 5501

The multi-container docker platform is deprecated and missing a lot of features that you'll find in the plain jane Docker platform on EB. However the docs are extremely confusing as you noticed above. Check out this stack overflow post for more details.

How to use multi container docker in Elastic beanstalk using Amazon linux 2?

Upvotes: 4

Marcin
Marcin

Reputation: 238957

Docker running on 64bit Amazon Linux 2/3.2.2

You are using Docker running on 64bit Amazon Linux 2/3.2.2 which, as the error write, is used only for Dockerrun.aws.json v1.

To use v2, you have to use EB platform:

Multi-container Docker running on 64bit Amazon Linux

Upvotes: 5

Related Questions