Not sure all the hate with Docker. It works and has a good ecosystem.
The DB command in the first approach seems like something docker got rid of a long time back when they deprecated the —link stuff. Just create a network and attach containers to it and then you get DNS for free.