I defined a container in a docker-compose file. I want to access a non-docker server name (say database.xyz) inside the container as the dns name mydb.
How to define that in the compose file?
I defined a container in a docker-compose file. I want to access a non-docker server name (say database.xyz) inside the container as the dns name mydb.
How to define that in the compose file?
You can add an
extra_hosts
section:Documentation on this can be found at: https://docs.docker.com/compose/compose-file/#extra_hosts
You can use aliases.
Here is the example.