Jumpers and the Software-Defined Localhost
coreos.com
coreos.com
A couple issues:
1. Using localhost seems like a bad idea (I have the expectation that traffic is local to the instance if using localhost). 2. Managing more then a couple instances of this will be unmaintainable if done manually. There will need to be some controller logic happening.
Maybe I am missing something, but why not add a second dedicated virtual ethernet adapter where all your containers can talk (works across containers and across servers)? This is traditionally how you would handle something like this. We have dedicated nonroutable reserved address space configured to handle all this internal datacenter traffic.
I believe Docker is guaranteed to have the docker0 interface[1] available, but perhaps the proposed mechanism doesn't want to tie itself to Docker so tightly?
On my setup, for instance, I use br0 and share the same bridge for containers and VMs.
It starts to fall over when you have, for example a MySQL slave that needs to connect to a MySQL master. But now the listening slave on 3306 is trying to connect to localhost:3306.
I would strongly recommend that the CoreOS team reach out to ARIN (the IANA operator) to get a special use /24 assigned for these "magic addresses" and not hijack 127.0.0.0/8.
At the minimum, hijack 255.255.255.255 instead.
* Stateless or Transparent master/master backend
Example: Memcached cluster
Use load balancing in the proxy layer
* Failover backend with failover on server side Examples: Mysql master/slave
Use failover logic in the proxy layer
* Failover backend with failover on the client side Example: HA RabbitMQ cluster
Above suggestion from polvi is needed nc -l 127.0.0.2 9999
Then "all" you need to something to map the 127.0.0.n against the docker instance.
This even works on windows by the way. Just start up that second tomcat or whatever with the next 127.0.0.n address and enjoy.localhost is but a name, which happens to be tied to ::1 or 127.0.0.1. I agree though that it should be outside of the default 127.0.0.1 instance, instead it can be anywhere on the 127.0.1.x network for example.
Or even better use an IPv6 ULA prefix instead.
It seems to me like this is a network layer proposal, while link containers are more about name based discovery at the Docker layer.
[1] http://docs.docker.io/en/latest/use/working_with_links_names...
edit: I'm wrong.
But, I am still hoping for a local OpenFlow compatible software switch, that can exploit network namespaces as a local optimization. That way you can leave your cluster's networking setup, from network edge to docker container, to a centralized controller.