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

5

5

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

Unitive answered 9/12, 2020 at 19:9 Comment(0)
S
5

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
Spouse answered 10/12, 2020 at 6:30 Comment(1)
thanks in the end I ended up using multi-container docker platform with Dockerrun.aws.json v2. AWS documentation says 64bit Amazon Linux 2 is the newer version for docker platform that supposed to work with docker-compose and Dockerrun.aws.json v3 but I couldn't make it work with docker-compose and couldn't find documentation for v3. I will also go ahead and update title of this post to fit more appropriately with this Q&A, Thanks again.Unitive
C
4

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?

Covered answered 3/9, 2021 at 12:43 Comment(0)
L
0

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.

Laboratory answered 30/9, 2021 at 15:7 Comment(0)
P
0

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.

Postmaster answered 27/11, 2021 at 21:26 Comment(0)
F
0

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"
}
Fossorial answered 29/10 at 5:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.