Docker Community Forums

Share and learn in the Docker community.

How to simulate networks mode service with services from another docker compose

Hey everyone

I’ve a docker-container with a VPN service and want use it to proxy the network of services defined in another docker-container.

How does the network_mode: service works?

Basically I want to achieve this:

version: '3.9'
services:
  expressvpn:
    container_name: expressvpn
    image: polkaned/expressvpn
    privileged: true
    cap_add:
      - NET_ADMIN
    # other settings...

  transmission:
    container_name: transmission
    image: ghcr.io/linuxserver/transmission
    networks_mode: services:expressvpn
    depends_on: 
      - expressvpn
    # other settings...

But with separated docker-compose’s