2

I created an AWS Elastic Beanstalk environment with a Load Balancer configured on ports 80 and 8080, I also turned off proxy (was Nginx initially). I created simple Node.js app and Dockerfile for it. Also I added file Dockerrun.aws.json with content:

{
  "AWSEBDockerrunVersion": "1",
  "Ports": [
    {
      "HostPort": "8080",
      "ContainerPort": "8080"
    }
  ]
}

I have my own image, not published anywhere so I didn't mentioned the Image section. After deployment I see one Docker container running with a single port 8080 opened (as expected). But the Elastic Beanstalk system doesn't forward this port to internal IP address.

What am I doing wrong and how to instruct Elastic Beanstalk to forward port from container to host (I know how to do it manually but it is not the case for Elastic Beanstalk) ?

1
  • did you expose the port 8080 in the Dockerfile?
    – G. I. Joe
    Aug 18, 2020 at 0:40

2 Answers 2

1

I had the same problem in a rails container (port 3000 using puma) by default rails server only binds localhost to the listening interface, I had to use -b option to bind 0.0.0.0 and that solved the problem.

In react I have no the same problem cause npm serve package binds all interfaces by default

0

I had a very similar issue:

  • A single Docker container with port 8080 exposed;
  • Proxy set to none (nginx disabled);
  • Dockerrun.aws.json similar to the one in the question, but using a pre-built image instead of a Dockerfile;
  • Application Load Balancer (ALB) configured with the default process that routes requests to port 8080 on the servers.

In this configuration, the application container started on the server, but Elastic Beanstalk didn't map port 8080 of the port to the port of the container. It worked if I mapped the port manually, starting another container using the same image. There were no error messages in the logs, and nothing in documentation explained what the problem can be.

Changing the ALB configuration to use port 80 instead of 8080 for the process resolved this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.