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.