Connect to another container using Docker compose

后端 未结 1 748
感动是毒
感动是毒 2021-02-07 15:41

I need to use two containers together: one with Tomcat and another with a Database.

I have created the following yaml file which describes the services:



        
相关标签:
1条回答
  • 2021-02-07 16:08

    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

    0 讨论(0)
提交回复
热议问题