Skip to content
Advertisement

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?

Advertisement

Answer

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
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement