Deploying Elastic Beanstalk applications from Docker containers
Elastic Beanstalk supports the deployment of web applications from Docker containers. With Docker containers, you can define your own runtime environment. You can also choose your own platform, programming language, and any application dependencies, such as package managers or tools, which typically aren't supported by other platforms. Docker containers are self contained and include all the configuration information and software that your web application requires to run. All environment variables that are defined in the Elastic Beanstalk console are passed to the containers.
The topics in this chapter assume that you have some knowledge of Elastic Beanstalk environments. If you
haven't used Elastic Beanstalk before, try the getting started
tutorial to learn the basics. This chapter also assumes that you have a basic understanding of Docker and how it works. For more information see Docker overview
The Docker platform branches
The Elastic Beanstalk Docker platform supports two platform branches based on Amazon Linux 2.
-
Docker Running on 64bit Amazon Linux 2 – Elastic Beanstalk deploys and manages the Docker containers on the EC2 instances running on the Beanstalk environment.
-
ECS Running on 64bit Amazon Linux 2 – Elastic Beanstalk indirectly calls Amazon Elastic Container Service (Amazon ECS) to handle the Docker container deployments. ECS deploys and manages an ECS cluster in the Beanstalk environment. The ECS cluster contains EC2 instances that host Docker containers. To accomplish this orchestration, Elastic Beanstalk creates an ECS Task definition which also includes a Container definition.
If you have an environment that's running on the retired Multi-container Docker running on Amazon Linux AMI (AL1) platform branch, we recommend that you migrate to the ECS Running on 64bit Amazon Linux 2 platform branch. Doing so offers you a straightforward migration path to Amazon Linux 2. If you don't have an Elastic Beanstalk environment running on an ECS based platform branch, we recommend you use the other platform branch, Docker Running on 64bit Amazon Linux 2. This offers a simpler approach and requires less resources.
Docker running on Amazon Linux 2
This platform branch offers both single-container and multi-container support. Elastic Beanstalk deploys a Docker image and source code to EC2 instances on this platform branch. Use the Docker Compose tool on the Docker platform to simplify your application configuration, testing, and deployment. For more information about this platform branch, see Using the Docker platform branch.
ECS running on 64bit Amazon Linux 2
We provide this branch for customers who need a migration path to Amazon Linux 2 from the retired platform branch Multi-container Docker running on (Amazon Linux AMI). The latest platform branch supports all of the features from the retired platform branch. No changes to the source code are required. For more information, see Migrating Multi-container Docker running on Amazon Linux to ECS on Amazon Linux 2.
This platform branch uses Amazon ECS to coordinate a deployment of multiple Docker containers to an Amazon ECS cluster in an Elastic Beanstalk environment. The instances
in the environment each run the same set of containers, which are defined in a Dockerrun.aws.jsonv2
file. For more information, see Using the Amazon ECS platform branch.
Retired platform branches running on Amazon Linux AMI (AL1)
On July 18,2022, Elastic Beanstalk set the status of all platform branches based on Amazon Linux AMI (AL1) to retired. Expand each section that follows to read more about each retired platform branch and its migration path to Amazon Linux 2.
This platform branch can deploy a Docker image, described in a Dockerfile or a Dockerrun.aws.json
v1 definition.
This platform branch runs only one container for
each instance. Its succeeding platform branch, Docker running on 64bit Amazon Linux 2, supports multiple Docker containers per instance.
We recommend that you create your environments with the newer and supported platform branch Docker running on 64bit Amazon Linux 2. You can then migrate your application to the newly created environment. For more information about creating these environments, see Using the Docker platform branch. For more information about migration, see Migrating your Elastic Beanstalk Linux application to Amazon Linux 2.
This platform branch uses Amazon ECS to coordinate a deployment of multiple Docker containers to an Amazon ECS cluster in an Elastic Beanstalk environment. If you're currently using this retired platform branch, we recommend that you migrate to the latest ECS Running on 64bit Amazon Linux 2 platform branch. The latest platform branch supports all of the features from this discontinued platform branch. No changes to the source code are required. For more information, see Migrating Multi-container Docker running on Amazon Linux to ECS on Amazon Linux 2.
In addition to the two generic Docker platforms, there is also the Preconfigured Docker GlassFish platform branch that runs on the Amazon Linux AMI operating system (AL1).
This platform branch has been superseded by the platform branch Docker Running on 64bit Amazon Linux 2. Deploy GlassFish and your application code to an Amazon Linux 2 Docker image to easily migrate your GlassFish application to this newer and supported platform branch. For more information, see Deploying a GlassFish application to the Docker platform.