简体   繁体   中英

django+docker to elastic beanstalk

I created a super simple django app in docker, following these instructions: 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. Should I also provide Dockerrun.aws.json ?

here is what I have in 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 :

  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. From the official docs :

Multicontainer Docker instances on Elastic Beanstalk require a configuration file named 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.

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