how to configure docker with floating ip?

July 20, 2017 531 views
Docker Ubuntu 16.04

Hi Guys,

On my Droplet, let's say

i have IP ADDRESS: X.X.X.99
I assign a new floating IP address like: X.X.X.100

I would like to run two docker container like that

docker run --name mynginx1 -p X.X.X.99:80:80 nginx
docker run --name mynginx2 -p X.X.X.100:80:80 nginx

The second command is not working so far.

What should i do to make it work?

Thank you!

Antoine

1 Answer

Hi @antoine0148fdc88ebae8de13b

When using the Floating IP, the droplet is assigned an Anchor IP, which is the IP you should listen to.
Read more about Anchor IP here - and how to retrieve it:
https://www.digitalocean.com/community/tutorials/how-to-use-floating-ips-on-digitalocean#droplet-anchor-ips

A DigitalOcean Floating IP is a publicly-accessible static IP address that can be mapped to one of your Droplets. A Floating IP can also be instantly remapped, via the DigitalOcean Control Panel or API, to one of your other Droplets in the same datacenter. This instant remapping capability grants you the ability to design and create High Availability (HA) server infrastructures by adding redundancy to the entry point, or gateway, to your servers.
Have another answer? Share your knowledge.