Linking containers for a multiple container setup

Maybe How to use Docker multiple containers without exposing ports is what you are looking for, i.e. if you link to the data container then both DISCOURSE_DB_HOST and DISCOURSE_REDIS_HOST should both be set to data