Wait for the container terminate at the end of CmdRun

Fixes the race condition between docker run and docker logs from #428.
Merge pull request #444 from lopter/master

Fixe the race condition between docker run and docker logs from #428
update TestRunDisconnectTty to reflect the correct behavior of CmdRun
'docker ps' shows port mappings
Exclude loopback-to-loopback connections from DNAT rules, to allow userland proxying
Emulate DNAT in userland for loopback-to-loopback connections. This makes container ports available from localhost.
Shutdown loopback-to-loopback proxy when unmapping a port
Add a test for allocating tcp ports and reaching them on localhost