I have an ubuntu server running docker with one container. My server ip address is in my vpc. It has tow bridges (docker0 ans lxcbr0).

My container ip address is

The host and the container can ping themselves.

I have another server in my vpc with for ip address. I just want my to reach my containers from this server but I don't know how to do this.

My two servers can ping themselves to.

I try to do this configuring my vpc routes table to route targeted requests to but it doesn't work.

Any idea ?


It sounds like you also need to disable Source/Destination IP Check on the instance hosting the containers (and you need the static route in the VPC route table, pointing to that instance by id). VPC network infrastructure drops IP traffic with IP addresses that don't make sense based on what the infrastructure knows internally about IP addresses associated with each instance. This setting changes that functionality on instances where you apply it. If you have a NAT instance, you'll notice this is already done for that instance, otherwise it wouldn't be able to route external traffic to/from other instances.


This is also on Instance Actions in the console.


You can expose the container port (docker run -p 1234:1234) and connect to your ec2 instances address (10.x.y.z:1234)

To avoid hardcoding addresses on the consumer side, you can use the ambassador pattern: https://docs.docker.com/engine/admin/ambassador_pattern_linking/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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