更新时间:2022-11-07 13:08:09
您需要在docker-compose
中配置links
以便能够解析:
you need to configure links
in your docker-compose
to be able to resolvable:
来自docker-compose Docs:
from docker-compose Docs:
链接到另一个服务中的容器.既可以指定服务名称,也可以指定链接别名(SERVICE:ALIAS),也可以仅指定服务名称.
Link to containers in another service. Either specify both the service name and a link alias (SERVICE:ALIAS), or just the service name.
web:
links:
- db
- db:database
- redis
,也请参见@ Mishi.Srivastava
and see the comment also from @Mishi.Srivastava