This is useful if a container exposes a service on a port and you need to be able to hit it at a different port, for example if one container stubs out two collaborator services on ports 1234 and 2345 but your program expects to hit the collaborators both on port 80 (and for some reason it's not trivial to change that).
The example docker-compose.yml
assumes that you have the stubber (in this case, fake_sns) which listens on port 443 on the docker network, and that you have my_consumer
which will hit http://sns.us-east-1.amazonaws.com:80 and you want it to use fake_sns instead.
Note that the portforwarder uses inotify to watch /etc/hosts which docker will update automatically whenever a linked container IP changes.