How to alias non-docker host's for an application running in container

Hi

I was trying to setup a docker configuration allowing a docker image to be immutable when being passed along in the devop’s pipeline from development to production.

This application uses a db connection to do database stuff. In the image, we would like to use a static (immutable) database configuration string pointing to the appropriate database, let’s call the db-host “waterdata”.

We’ll have three containers running the image corresponding to our environments for developing, testing and for production. To keep a immutable image we would like to map the “alias” waterdata to different database servers depending on the environment the container runs in:

  • Environment development: waterdata must map to database server waterdata_development
  • Environment test: waterdata must map to database server waterdata_test
  • Environment production: waterdata must map to database server waterdata_production

Found a lot of promising stuff that would work when the databases would also be deployed in a container. But - how can this be solved with databases running directly on non-docker host’s?

Was trying to get a configuration working with a bridge network like this:
docker network create -d bridge --aux-address=“pubdb=[database host ip address]” geodbs
Giving me the error: no matching subnet for aux-address [database host ip address]

What are the solutions to achieve this?

Thanks
Oliver