linux - 防止 Docker Compose 创建单独的网络

标签 linux sockets networking docker docker-compose

我发现Docker Compose使用 version 2 时将容器放置在单独的网络中他们的 YAML 语法。这使得与现有容器的链接变得困难。

有没有办法防止这种情况,并恢复到 version 1 的行为,而不实际恢复?

最佳答案

Is there a way to prevent this, and revert to the behavior of version 1, without actually reverting?

在您的服务配置中,指定:

network_mode: bridge

例如:

version: "2"

services:
  web:
    build: web
    network_mode: bridge

关于linux - 防止 Docker Compose 创建单独的网络,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36663555/

相关文章:

php - Composer 安装/更新不起作用

linux - haskell cabal : Mysterious missing or recursive dependencies

c# - 有效地使用数千个超时任务

Android Volley NetworkImageView 不适用于某些图像

java - 检测网络中重叠社区的库?

c++ - 为什么我不能用 "unsigned"限定别名类型?

android - 在 Android 上使用 Runtime.getRuntime().exec() 执行 "stat"时出现 IOException?

cocoa - 在 Cocoa 中,如何设置数据包的 TTL?

c# - 适用于 Windows 和 Linux 的同一台机器上的套接字

mysql - 如何使用 SQL Developer 从虚拟 PC 启用与 MySQL 数据库的连接