Multiple host ips to docker container

When you publish a port, you can specify an IP address to bind to. This means that I can add multiple IP addresses to my docker host, and specify each IP as I create/run the containers:

docker run -d -p 192.168.56.50:80:80 nginx

This would bind the nginx container’s port 80 to port 80 on 192.168.56.50.

It is also possible to specify a range of ports when you publish them:

docker run -d -p 100-200:100-200 nginx

And you can indeed combine the syntaxes:

docker run -d -p 192.168.56.50:100-200:100-200

One thing to keep in mind, is that docker does fire up one docker-proxy process per port that is mapped. Mapping all ports would cause a lot of processes to be started on your host system. You can disable the userland proxy setting in favor of a NAT implementation: https://docs.docker.com/articles/networking/

/Jeff