Any ideas or suggestions to push the envelope of the outlined approaches would be most helpful.
Approach A: Use hosts entry which is added automatically by Docker (when linking).
I found that advice on the web but when I peeked into the hosts file for my WEB service’s container (which has a mongodb container linked into it) … I did not find any entry added automatically by Docker.
Approach B: Docker Cloud inserts a linked service’s env variables which is quite convenient but if I try to reuse them to configure an env variable that my web services uses like so:
DB_URL : mongodb://$MONGO_PORT_27017_TCP_ADDR:$MONGO_PORT_27017_TCP_PORT/sellerapp-dev-pulkit
Then it does not get resolved because the linked variables’ values aren’t substituted. If I change my code itself to reuse
MONGO_PORT_27017_TCP_*env variables then I risk tightly coupling my code to docker