Connect to another container using Docker compose

Use the alias “db” that you have defined in file to refer to the database host name.

Containers for the linked service will be reachable at a hostname
identical to the alias, or the service name if no alias was specified.

Source: https://docs.docker.com/compose/compose-file/compose-file-v2/#links

Leave a Comment