0
votes

I've can't seem to get my head around the Dockerrun.aws.json file, which is needed to run a multi-container docker environment on AWS Elastic Beanstalk.

Everything works fine locally, when I run my app through Docker-Compose. The following is my docker-compose.yml file:

version: '2'
services:
  interfaceserver:
    build: .
    command: daphne -b 0.0.0.0 -p 8000 restbench.asgi:channel_layer
    user: app
    working_dir: /app
    ports:
      - 8000:8000
    depends_on:
      - database
      - redis
  workerserver:
    build: .
    user: app
    working_dir: /app
    command: python manage.py runworker
    depends_on:
      - database
      - redis
  database:
    image: postgres:9.5
  redis:
    image: redis:3.0-alpine

Essentially I am trying to run four services. A Interface-Server, a Worker-Server, a Postgres Database and a Redis Server. The Interface-Server and the Worker-Server and my own Django Builds from a local Dockerfile which are in the same directory as the docker-compose.yml

Now I am trying to deploy my app to Elastic Beanstalk and, from what I understand, I need a Dockerrun.aws.json, which is the same as a docker-compose.yml, just for AWS. I try to read the docs from EBS, but as I mentioned above I can't get my head around the part where I specify the Interface- and Worker-Server. The Database and Redis part is easy, but I don't understand how to specify how to build these two servers in the json file for AWS.

Any help is highly appreciated.

1

1 Answers

3
votes

We can't build images from Dockerfile anymore in "AWSEBDockerrunVersion: 2". It is possible if we have a single container setup with single Dockerfile by using "AWSEBDockerrunVersion: 1".

In your case, you have to build & push images by your own or let your CI server do it. Define the images in your Dockerrun.aws.json v2.

Ref from AWS docs -