[英]Prevent Docker Compose from creating separate network
I discovered that Docker Compose places containers in a separate network when using version 2 of their YAML syntax. 我发现Docker Compose在使用其YAML语法的版本2时将容器放置在单独的网络中。 This makes linking with existing containers difficult. 这使得与现有容器的链接变得困难。
Is there a way to prevent this, and revert to the behavior of version 1 , without actually reverting? 有没有办法防止这种情况,并恢复到版本1的行为,而无需实际恢复?
Is there a way to prevent this, and revert to the behavior of version 1, without actually reverting? 有没有办法防止这种情况,并恢复到版本1的行为,而无需实际恢复?
In your service configuration, specify: 在您的服务配置中,指定:
network_mode: bridge
For example: 例如:
version: "2"
services:
web:
build: web
network_mode: bridge
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.