'Environment variable ElasticBeanstalk Multicontainer

I'am trying do deploy 2 containers by using docker-compose on ElasticBeanstalk with new Docker running on 64bit Amazon Linux 2 (v3). When I add .env_file directive in compose I got error

Stop running the command. Error: no Docker image specified in either Dockerfile or Dockerrun.aws.json. Abort deployment

My working compose:

version: '3.9'
services:
  backend:
    image: my_docker_hub_image_backend
    container_name: backend
    restart: unless-stopped
    ports:
      - '8080:5000'

  frontend:
    image: my_docker_hub_image_frontend
    container_name: frontend
    restart: unless-stopped
    ports:
      - '80:5000'

After which the error occurs

version: '3.9'
services:
  backend:
    image: my_docker_hub_image_backend
    env_file: .env
    container_name: backend
    restart: unless-stopped
    ports:
      - '8080:5000'

  frontend:
    image: my_docker_hub_image_frontend
    container_name: frontend
    restart: unless-stopped
    ports:
      - '80:5000'

What am I doing wrong? In "Software" "Environment properties" are added



Solution 1:[1]

The problem was that the server could not pull images from private docker hub without authorization.

Solution 2:[2]

  1. For the document: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html#docker-env-cfg.env-variables. You are right.

  2. But error will be in eb-engine.log look like: "Couldn't find env file: /opt/elasticbeanstalk/deployment/.env"

Please try using absolute path:

env_file:
  - /opt/elasticbeanstalk/deployment/env.list

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ioannrove
Solution 2 Th?ng L?u