docker-compose comes to save the day when it comes to how to connect containers. Your Dockerfile will specify which underlying OS is used. Preserve state of your database with data volumes.
Once you understand how docker works, using the YAML file can become useful to lighten your load.
[1] https://github.com/glowdigitalmedia/glowmachine-docker/blob/...