简体   繁体   English

AWS 上的多容器 Docker

[英]Multi-Container Docker on AWS

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.我似乎无法理解 Dockerrun.aws.json 文件,这是在 AWS Elastic Beanstalk 上运行多容器 docker 环境所必需的。

Everything works fine locally, when I run my app through Docker-Compose. The following is my docker-compose.yml file:当我通过 Docker-Compose 运行我的应用程序时,在本地一切正常。以下是我的 docker-compose.yml 文件:

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.一个接口服务器、一个工作服务器、一个 Postgres 数据库和一个 Redis 服务器。 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 Interface-Server 和 Worker-Server 以及我自己的 Django 从本地 Dockerfile 构建,它们与 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.现在我正在尝试将我的应用程序部署到 Elastic Beanstalk,据我所知,我需要一个 Dockerrun.aws.json,它与 docker-compose.yml 相同,仅适用于 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.我尝试阅读 EBS 的文档,但正如我上面提到的,我无法理解指定接口和工作服务器的部分。 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.数据库和 Redis 部分很简单,但我不明白如何在 AWS 的 json 文件中指定如何构建这两个服务器。

Any help is highly appreciated.非常感谢任何帮助。

We can't build images from Dockerfile anymore in "AWSEBDockerrunVersion: 2". 我们不再可以在“ AWSEBDockerrunVersion:2”中从Dockerfile构建映像。 It is possible if we have a single container setup with single Dockerfile by using "AWSEBDockerrunVersion: 1". 通过使用“ AWSEBDockerrunVersion:1”,可以使用单个Dockerfile进行单个容器设置。

In your case, you have to build & push images by your own or let your CI server do it. 在您的情况下,您必须自己构建并推送图像,或者让CI服务器来完成。 Define the images in your Dockerrun.aws.json v2. 在Dockerrun.aws.json v2中定义图像。

Ref from AWS docs - 来自AWS文档的参考-

According to the docs , Amazon Linux 2 now supports docker-compose files and doesn't have the limitation of needing prebuilt images for Multi-Container Docker environments anymore.根据文档,Amazon Linux 2 现在支持 docker-compose 个文件,不再需要为多容器 Docker 环境预构建图像的限制。

The Multi-container Docker platform on Amazon Linux AMI requires that you specify prebuilt application images to run as containers. Amazon Linux AMI 上的多容器 Docker 平台要求您指定预构建的应用程序映像作为容器运行。 After migrating, you will no longer have this limitation, because the Amazon Linux 2 Docker platform also allows Elastic Beanstalk to build your container images during deployment.迁移后,您将不再有此限制,因为 Amazon Linux 2 Docker 平台还允许 Elastic Beanstalk 在部署期间构建您的容器镜像。

... ...

The Docker Compose tool uses the docker-compose.yml file for configuration of your application services. Docker Compose 工具使用 docker-compose.yml 文件来配置您的应用程序服务。 This file replaces your Dockerrun.aws.json v2 file in your application project directory and application source bundle.此文件替换应用程序项目目录和应用程序源包中的 Dockerrun.aws.json v2 文件。

We haven't migrated our environments yet, but that sounds promising.我们还没有迁移我们的环境,但这听起来很有希望。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在多容器Docker设置中运行Django迁移 - Running Django migrations in a multi-container Docker setup 在ElasticBeanstalk上部署多容器应用程序时出现CannotPullContainerError - CannotPullContainerError on Deploying Multi-container App on ElasticBeanstalk Azure 容器实例:从 Django+Nginx+Postgres 创建多容器组 - Azure Container Instances: Create a multi-container group from Django+Nginx+Postgres Azure web-app - Django 应用程序的多容器单元未成功启动 - Azure web-app - Multi-container unit was not started successfully for Django app 多容器应用程序中无法访问的数据库容器 - django.db.utils.OperationalError:(2002,“无法连接到'db'(115)上的 MySQL 服务器”) - unreachable db container in a multi-container application - django.db.utils.OperationalError: (2002, “Can't connect to MySQL server on 'db' (115)”) Celery Retry无法在运行Docker 1.6.2版的AWS Beanstalk上运行(多容器) - Celery Retry not working on AWS Beanstalk running Docker ver.1.6.2(Multi container) 如何在Docker中创建多容器Web应用程序 - How to create a multi container web application in docker AWS ElasticBeanstalk 多 Docker 部署失败 - AWS ElasticBeanstalk Multi-Docker Deployment Failure Python 3.4 Docker容器中的AWS Elastic Beanstalk container_commands - AWS Elastic Beanstalk container_commands in Python 3.4 Docker Container 如何在AWS ECS docker容器中获取AWS凭据? - How do I get AWS credentials in the AWS ECS docker container?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM