Multi-Container Docker Platform AWS EB

If your application consists of only one container, all you need is a Dockerfile in the repository: Elastic Beanstalk will use it to build the image and run the container with application.

However, if your app consists of more than one container (eg. you need to use docker compose to run it), then you need to add Dockerrun.aws.json with the configuration of your containers. Of course, the images must be built and pushed to the public registry first .

This article will show you how to automate the whole process with Buddy. We have covered the single-container configuration in a separate article.

Set a Multi-Docker application in Elastic Beanstalk

  1. Log in to your AWS account
  2. Go to the Elastic Beanstalk service
  3. Add the application:

    • Select Web server as the Tier
    • Select Multi-container Docker as the Platform

Copy the Access key and the Secret key

To automate the deployment you need a user with the permission AWSElasticBeanstalkFullAccess so you can copy their Access and Secret keys. To create such user do the following:

  1. Log in to your AWS account
  2. Go to Users and click Add user
  3. Set the access type to Programmatic Access

  4. Look up and addAWSElasticBeanstalkFullAccess permission
  5. Once the user is added, download the CSV with its access details

Configure a pipeline in Buddy

Now you can create a pipeline that automatically build a Docker image on push to the repository, push it to the Docker Hub and deploy to Elastic Beanstalk. In this example we'll use this repository, a Node.JS app with Redis.

  1. Add a new project in Buddy and select GitHub as the provider.
  2. Choose the repository from the list:

  3. Add a new pipeline and set the trigger mode to On every push:
  4. Add the Docker build action that will build and push your image to the registry:

  5. Add the Upload to ElasticBeanstalk action

    • Copy and paste the Access and Secret keys from your AWS account
    • Select your AWS region and Application
    • Select Repository as the deployment source

When you're ready, make a push and watch Buddy build and deploy your Docker image.

Notes:

  • You can add an action that will build and test your application before deploying it to Elastic Beanstalk as a Docker image. In this case select the Filesystem as the source in the deployment action.
  • If you have more than one Dockerfile in the app, you can add a build action for every image.

Last modified on April 26, 2022

Questions?

Not sure how to configure a pipeline for your process? Reach out on the live-chat or contact support

Get Started

Sign up for free and deploy your project in less than 10 minutes.