Listing 6. Linking containers in the same server is done via /etc/hosts entries. # su - # docker exec -it MYWEB bash root@fbff94177fc7:/var/www/html# cat /etc/hosts 172.17.0.3 fbff94177fc7 127.0.0.1 localhost ... 172.17.0.2 MYDB root@fbff94177fc7:/var/www/html# export declare -x MYDB_PORT="tcp://172.17.0.2:3306" declare -x MYDB_PORT_3306_TCP="tcp://172.17.0.2:3306" declare -x MYDB_PORT_3306_TCP_ADDR="172.17.0.2" declare -x MYDB_PORT_3306_TCP_PORT="3306" declare -x MYDB_PORT_3306_TCP_PROTO="tcp" ...