环境变量 ElasticBeanstalk 多容器

Environment variable ElasticBeanstalk Multicontainer

我正在尝试通过在 ElasticBeanstalk 上使用 docker-compose 和 64 位 Amazon Linux 2 (v3) 上的新 Docker 运行 来部署 2 个容器。当我在 compose 中添加 .env_file 指令时出现错误

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

我的工作作文:

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'

之后发生错误

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'

我做错了什么? 在“软件”中添加“环境属性”

问题是服务器无法在未经授权的情况下从私有 docker 中心拉取图像。

  1. 对于文档:https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html#docker-env-cfg.env-variables。你是对的。

  2. 但是 eb-engine.log 中会出现错误:“找不到环境文件:/opt/elasticbeanstalk/deployment/.env”

请尝试使用绝对路径:

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