简体   繁体   中英

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. 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?

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

In your service configuration, specify:

network_mode: bridge

For example:

version: "2"

services:
  web:
    build: web
    network_mode: bridge

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM