[GH-ISSUE #2604] Docker client is always relayed in network_mode: host #5578

Open
opened 2026-08-05 01:04:00 -04:00 by saavagebueno · 0 comments
Owner

Originally created by @Spiritreader on GitHub (Sep 14, 2024).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/2604

Describe the problem

I have the scenario that I want netbird to be available on the host, (accessing services that run there).
I cannot install it directly, because I am using unraid, and this OS generally doesn't allow irunning applications without docker.
So, in order to connect to the host, I have to spin up the netbird client in host network mode.

Scenario 1 - Network Mode Host for Netbird Client Container

Example compose file

services:
  netbird:
    image: netbirdio/netbird:latest
    container_name: pt-netbird-client
    restart: unless-stopped
    network_mode: "host"
    privileged: true
    cap_add:
      - NET_ADMIN
      - SYS_ADMIN
    environment:
      - NB_MANAGEMENT_URL=https://my.selfhosted.instance
      - NB_SETUP_KEY=asetupkey
    volumes:
      - /mnt/user/appdata/netbird-client:/etc/netbird
      - /etc/resolv.conf:/etc/resolv.conf

From my desktop, I get:

 server.netbird.selfhosted:
  NetBird IP: 100.64.225.216
  Public key: PublicKey
  Status: Connected
  -- detail --
  Connection type: Relayed
  ICE candidate (Local/Remote): -/-
  ICE candidate endpoints (Local/Remote): -/-
  Relay server address: rels://my.selfhosted.relay
  Last connection update: 23 seconds ago
  Last WireGuard handshake: 11 seconds ago
  Transfer status (received/sent) 45.0 KiB/26.8 KiB
  Quantum resistance: false
  Routes: 192.168.1.0/24
  Latency: 22.3312ms

But I can reach services running on the server itself. Aka
curl server.netbird.selvhosted will return the page that's running on this peer.

Scenario 2 - Network Mode Bridge for Netbird Client Container

Example compose file

services:
  netbird:
    image: netbirdio/netbird:latest
    container_name: pt-netbird-client
    restart: unless-stopped
    privileged: true
    cap_add:
      - NET_ADMIN
      - SYS_ADMIN
    environment:
      - NB_MANAGEMENT_URL=https://my.selfhosted.instance
      - NB_SETUP_KEY=asetupkey
    volumes:
      - /mnt/user/appdata/netbird-client:/etc/netbird
      - /etc/resolv.conf:/etc/resolv.conf

This will create a new docker network, and immediately produce a P2P connection.

 server.netbird.selfhosted:
  NetBird IP: 100.64.225.216
  Public key: PublicKey
  Status: Connected
  -- detail --
  Connection type: P2P
  ICE candidate (Local/Remote): host/prflx
  ICE candidate endpoints (Local/Remote): 192.168.75.1:56565/REMOTEADDR
  Relay server address: rels://my.selfhosted.relay
  Last connection update: 11 seconds ago
  Last WireGuard handshake: 13 seconds ago
  Transfer status (received/sent) 20.7 KiB/14.3 KiB
  Quantum resistance: false
  Routes: 192.168.1.0/24
  Latency: 21.2773ms

However, because it now runs in an isolated docker network, I can't access services running on server.netbird.selfhosted anymore, and instead only have access to the netbird container.

To Reproduce

Steps to reproduce the behavior:

  1. Set up the netbird image in host mode
  2. Observe "relayed"
  3. Set up the netbird image in bridge mode
  4. Observe "p2p"

Expected behavior

P2P is possible in both instances

Are you using NetBird Cloud?

self-hosted.

NetBird version

0.29.2

Do you face any (non-mobile) client issues?

Please provide the file created by netbird debug for 1m -AS.

I cannot do that, because interacting with netbird is broken in docker containers as it runs as foreground application.

Error: failed to connect to daemon error: context deadline exceeded
If the daemon is not running please run: 
netbird service install 
netbird service start
Originally created by @Spiritreader on GitHub (Sep 14, 2024). Original GitHub issue: https://github.com/netbirdio/netbird/issues/2604 **Describe the problem** I have the scenario that I want netbird to be available on the host, (accessing services that run there). I cannot install it directly, because I am using unraid, and this OS generally doesn't allow irunning applications without docker. So, in order to connect to the host, I have to spin up the netbird client in host network mode. ### Scenario 1 - Network Mode Host for Netbird Client Container Example compose file ```yaml services: netbird: image: netbirdio/netbird:latest container_name: pt-netbird-client restart: unless-stopped network_mode: "host" privileged: true cap_add: - NET_ADMIN - SYS_ADMIN environment: - NB_MANAGEMENT_URL=https://my.selfhosted.instance - NB_SETUP_KEY=asetupkey volumes: - /mnt/user/appdata/netbird-client:/etc/netbird - /etc/resolv.conf:/etc/resolv.conf ``` From my desktop, I get: ``` server.netbird.selfhosted: NetBird IP: 100.64.225.216 Public key: PublicKey Status: Connected -- detail -- Connection type: Relayed ICE candidate (Local/Remote): -/- ICE candidate endpoints (Local/Remote): -/- Relay server address: rels://my.selfhosted.relay Last connection update: 23 seconds ago Last WireGuard handshake: 11 seconds ago Transfer status (received/sent) 45.0 KiB/26.8 KiB Quantum resistance: false Routes: 192.168.1.0/24 Latency: 22.3312ms ``` But I can reach services running on the server itself. Aka `curl server.netbird.selvhosted` will return the page that's running on this peer. ### Scenario 2 - Network Mode Bridge for Netbird Client Container Example compose file ```yaml services: netbird: image: netbirdio/netbird:latest container_name: pt-netbird-client restart: unless-stopped privileged: true cap_add: - NET_ADMIN - SYS_ADMIN environment: - NB_MANAGEMENT_URL=https://my.selfhosted.instance - NB_SETUP_KEY=asetupkey volumes: - /mnt/user/appdata/netbird-client:/etc/netbird - /etc/resolv.conf:/etc/resolv.conf ``` This will create a new docker network, and immediately produce a P2P connection. ``` server.netbird.selfhosted: NetBird IP: 100.64.225.216 Public key: PublicKey Status: Connected -- detail -- Connection type: P2P ICE candidate (Local/Remote): host/prflx ICE candidate endpoints (Local/Remote): 192.168.75.1:56565/REMOTEADDR Relay server address: rels://my.selfhosted.relay Last connection update: 11 seconds ago Last WireGuard handshake: 13 seconds ago Transfer status (received/sent) 20.7 KiB/14.3 KiB Quantum resistance: false Routes: 192.168.1.0/24 Latency: 21.2773ms ``` However, because it now runs in an isolated docker network, I can't access services running on server.netbird.selfhosted anymore, and instead only have access to the netbird container. **To Reproduce** Steps to reproduce the behavior: 1. Set up the netbird image in host mode 2. Observe "relayed" 3. Set up the netbird image in bridge mode 4. Observe "p2p" **Expected behavior** P2P is possible in both instances **Are you using NetBird Cloud?** self-hosted. **NetBird version** 0.29.2 **Do you face any (non-mobile) client issues?** Please provide the file created by `netbird debug for 1m -AS`. I cannot do that, because interacting with netbird is broken in docker containers as it runs as foreground application. ``` Error: failed to connect to daemon error: context deadline exceeded If the daemon is not running please run: netbird service install netbird service start ```
saavagebueno added the triage-needed label 2026-08-05 01:04:00 -04:00
Sign in to join this conversation.
No Label triage-needed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#5578