简体   繁体   English

django + docker弹性beantalk

[英]django+docker to elastic beanstalk

I created a super simple django app in docker, following these instructions: https://docs.docker.com/compose/django/ 我按照以下说明在docker中创建了一个超级简单的django应用程序: https : //docs.docker.com/compose/django/

Everything works locally. 一切都在本地工作。 When I try to upload the folder that includes Dockerfile and docker-compose.yml to AWS Elastic Beanstalk as a multicontainer docker, it does not work. 当我尝试将包含DockerfileDockerfile docker-compose.yml的文件夹作为多docker-compose.yml AWS Elastic Beanstalk时,它不起作用。 Should I also provide Dockerrun.aws.json ? 我还应该提供Dockerrun.aws.json吗?

here is what I have in Dockerfile : 这是我在Dockerfile拥有的Dockerfile

   FROM python:3
   ENV PYTHONUNBUFFERED 1
   RUN mkdir /code
   WORKDIR /code
   ADD requirements.txt /code/
   RUN pip install -r requirements.txt
   ADD . /code/

and in docker-compose.yml : 并在docker-compose.yml

  version: '3'

  services:
    db:
      image: postgres
    web:
      build: .
      command: python3 manage.py runserver 0.0.0.0:8000
      volumes:
        - .:/code
      ports:
        - "8000:8000"
      depends_on:
        - db

Yes, you have to provide a Dockerrun file. 是的,您必须提供一个Dockerrun文件。 From the official docs : 官方文档

Multicontainer Docker instances on Elastic Beanstalk require a configuration file named Dockerrun.aws.json . Elastic Beanstalk上的多Dockerrun.aws.json Docker实例需要一个名为Dockerrun.aws.json的配置文件。 This file is specific to Elastic Beanstalk and can be used alone or combined with source code and content in a source bundle to create an environment on a Docker platform. 该文件特定于Elastic Beanstalk,可以单独使用,也可以与源代码中的代码和内容结合使用,以在Docker平台上创建环境。

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

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