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

3

7

Currently, Amazon deprecated Multi-container Docker running on 64bit Amazon Linux.Need migrate to Docker running on 64bit Amazon Linux 2. In 1st version , we used Dockerrun.aws.json v2 to manage multi container docker. In latest version (Docker running on 64bit Amazon Linux 2), we need to use Dockerrun.aws.json v3 or docker-compose. But there is no working example or blogs are available. Can i get working samples ?.

Colston answered 30/8, 2021 at 17:33 Comment(0)
D
9

In regards to Elastic Beanstalk and the Docker running on 64bit Amazon Linux 2 platform.

I was struggling too and finally got to the bottom of it. What confused me is that the documentation makes it seem like you can choose to use either, the Dockerrun.aws.json (v3) or a docker-compose.yml in your EB application package.

Then you go looking for the documentation on Dockerrun.aws.json (v3), and you won't find it anywhere.

The reason for this is that, you don't get a choice. If you want to run multiple containers you must include a docker-compose.yml in your application package. The only thing the Dockerrun.aws.json (v3) allows you to do is configure the s3 bucket and key to the location of your container repository authentication file ".dockercfg"

This is essentially the documentation for "Dockerrun.aws.json (v3)" it doesn't support anything similar to the "Dockerrun.aws.json (v2)

{
  "AWSEBDockerrunVersion": "3",
  "Authentication": {
    "bucket": "DOC-EXAMPLE-BUCKET",
    "key": "mydockercfg"
  }
}

Include a docker-compose.yml and you'll need the dockerrun.aws.json (v3) only if the docker images are in a private repository.

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/single-container-docker-configuration.html

Dinger answered 3/9, 2021 at 12:41 Comment(2)
Can you help me with 'bucket' value here? My image is in a private repository.Clave
The bucket refers to the bucket that the ".dockercfg" file is located in. this file would contain credentials to access your private repo. However if your private repo is hosted in ECR, that this config file is not needed.Dinger
G
3

According to AWS Docs, Multi-container Docker running on Amazon Linux can be migrated to ECS on Amazon Linux 2

This option seems to be easier to apply with the CLI than using the Elastic Beanstalk console because it requires 1 single command:

aws elasticbeanstalk update-environment \
--environment-name ${my-env} \
--solution-stack-name "64bit Amazon Linux 2 ${version} running ECS" \
--region ${my-region}

I'd suggest that you first clone the environment you'd like to upgrade, apply the command mentioned above to this copied environment and test it, if everything works as expected then you can use a blue/green deployment to avoid downtime.

I hope this helps someone!

Gambetta answered 4/7, 2022 at 16:55 Comment(0)
M
2

Now (2023), if you still need to migrate from a Multi-container Docker running on 64bit Amazon platform you can choose to create an ECS running on 64bit Amazon Linux 2/3.2.5 environment which will support the same Dockerrun.aws.json(v2) files as the multi-container one: Migrating Multi-container Docker running on Amazon Linux to ECS on Amazon Linux 2.

Or you can also try to migrate following the response given by Osain.

Magnuson answered 22/3, 2023 at 20:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.