Docker, EC2, and Network Interfaces

Hi Guys and Girls,
I’m breaking my head trying to solve this problem. Hopefully someone here can help me.

I have a docker container running inside an EC2 Instance and its running on port 80.
The default EC2 has an eth0 network interface with the private IP of the EC2
I have attached a second Network Interface (ENI) to the EC2, It takes place as eth1 with a different Private IP

When I try to reach the application running on port 80, I am able to do it through the IP of the eth0, but not from the IP of the eth1

How can I make sure that I can reach the application with the IP of eth1.

In Short:
EC2 has a private IP ( eht0 )
Network Interface attached to the same EC2 ( eth1 )
Docker running on EC2 on port 80
I can reach the container using eth0 IP, but not eth1 IP

Please if anybody has some ideas that would be awesome.

Thanks!

2 Likes

Any chance someone has figured out how to fix this issue sometime in the last 6 1/2 years? :grin: I’m running into the exact same problem today.

I am not sure how this could be a problem. Vanilla Docker (=installed from Docker’s own repositories) publishes a container port on 0.0.0.0:hostport.

The only thing that comes to mind that would prevent communication are missing allow rules in the security group assigned to the instance(s).

Though, I can not speak for the Docker Distribution on Amazon Linux - You could always raise a support ticket to the Amazon support and ask for guidance.