Hacker News new | ask | show | jobs
by virulent 4121 days ago
Ports inside a container aren't exposed publicly unless explicitly done.

Container linking lets containers connect to each other without exposing ports via docker.

The "linking" is exposed to the container via an /etc/hosts entry, so e.g. --link test-db:db adds "a.b.c.d db" to /etc/hosts which can be used by anything that needs it.

As mentioned by jon-wood, the simple linking approach only works with containers on the same machine unfortunately.

1 comments

The concepts of Linking are being revisited via the network revamp proposal with the help of Network Plugins : https://github.com/docker/docker/issues/9983. With the plugins providing State Distribution and Service Discovery the containers can be effectively linked across multi-host network.