简体   繁体   中英

Docker Compose env_file in Multicontainer Elastic Beanstalk

I have the following docker compose file:

version: '2'

services:
  app:
    build: .
    command: >
      bash -cex "
        export LC_ALL=C.UTF-8
        export LANG=C.UTF-8
        /virtualenv/bin/flask run -h 0.0.0.0 -p 5050
      "
    env_file: env
    links:
    - postgres
    ports:
    - 8080:8080

As you can see I'm using the env_file option to load my environment variables from the file env .

Now I'm trying to deploy this container to Elastic Beanstalk. This is my file Dockerrun.aws.json so far:

{
  "AWSEBDockerrunVersion": 2,

  "containerDefinitions": [

    {
      "name": "app",
      "image": "myorg/myimage",
      "essential": true,
      "memory": 256,
      "command": [
        "/bin/bash",
        "export LC_ALL=C.UTF-8",
        "export LANG=C.UTF-8",
        "/virtualenv/bin/flask run -h 0.0.0.0 -p 5050"
      ],
      "portMappings": [
        {
          "hostPort": 8080,
          "containerPort": 8080
        }
      ],
      "links": [
        "postgres",
      ]
    }

In the AWS Elastic Beanstalk documentation just mention the environment option to pass an array of env variables, but I can't find how to pass a file instead of an array of variables.

Does someone knows how to translate this docker-compose file to Dockerrun.aws.json file properly?

Regards.

Try container-transform .

$ pip install container-transform
$ cat docker-compose.yml | container-transform  -v

and it will print the ECS format to STDOUT.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM