This little shell script helps you add your containers' IPs in your /etc/hosts file.
Usage:
# docker run -d myimage
bd397fa957ce
# /path/to/docker-hosts myname bd397fa957ce
If myname is already in your /etc/hosts, it's removed first and the line removed is printed:
removed line from /etc/hosts:
172.17.0.3 my-host # bd397fa957ce847b7db1913db92bd4773c46af25fc95db15c417fa0f0ea07b26