Home > Software design >  Elastic Beanstalk - Docker/Flask App - 502 Gateway Error
Elastic Beanstalk - Docker/Flask App - 502 Gateway Error

Time:12-08

I am creating a simple Docker/Flask app that I wanted to deploy to elastic beanstalk but am unable to get it working.

The code for the backend app (including docker config) can be found here: https://github.com/rogebrd/sage/tree/move_to_docker/backend

For code deployment, I am pushing my code to s3 via a zip; script to do that can be found here: https://github.com/rogebrd/sage/blob/move_to_docker/scripts/bundle_to_zip.sh

The Elastic Beanstalk instance is pretty much in it's default configuration (only thing I changed was enabling logs)

  • setup using Docker running on 64bit Amazon Linux 2/3.4.9

The error I am getting when I hit the resource is - 502 - Gateway Error

Looking in var/log/eb-docker/containers/eb-current-app/stdouterr.log I am able to see the app is successfully spun up listening on port http://192.168.0.2:5000/

At this point, I don't really know where the issue could be originating from. My suspicion is that the ports aren't properly being mapped to which I have tried the .ebextensions that are in place now, using a Dockerrun.aws.json file instead of docker-compose, removing docker-compose entirely, and changing the server port to 8080 and 80 with no success.

Looking for any resources to point me in the right direction!

CodePudding user response:

You are using wrong ports in docker compose. Please change to:

    ports: [ '80:5000' ]
  • Related