netbird client inside docker: can not access to status or route list: context deadline exceeded #1110

Closed
opened 2025-11-20 05:24:15 -05:00 by saavagebueno · 4 comments
Owner

Originally created by @bravosierrasierra on GitHub (Jul 29, 2024).

Describe the problem

Can not access to netbird daemon from outside docker container.
Daemon successfully started and registered in mesh with
docker compose up -d

But i am can not access to daemon stats and routes:

$ docker compose exec netbird_client netbird --daemon-addr=unix:///var/run/netbird.sock status
Error: failed to connect to daemon error: context deadline exceeded
If the daemon is not running please run:
netbird service install
netbird service start

$ docker compose exec netbird_client ls -laF /var/run/
total 8
drwxr-xr-x 2 root root 4096 Jun 18 15:37 ./
drwxr-xr-x 1 root root 4096 Jul 29 14:48 ../
ubuntu@netbird-gw-dev-dc-01 .../docker-compose/netbird $

To Reproduce

use "docker compose up -d" and then "docker compose exec netbird_client netbird status"
with this docker-compose.yaml:

services:
  netbird_client:
    image: "netbirdio/netbird:latest"
    restart: always
    logging:
      driver: local
    labels:
      logging: "promtail"
      logging_jobname: "containerlogs"
    container_name: netbird_client
    cap_add:
      - NET_ADMIN
      - SYS_ADMIN
      - SYS_RESOURCE
    environment:
      - NB_SETUP_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      - NB_HOSTNAME=netbird-gw-dev-dc.domain.com
      - NB_SERVICE=netbird
      - NB_DAEMON_ADDR=unix:///var/run/netbird.sock
      - NB_MANAGEMENT_URL=https://mgmt.domain.com:33073
      - NB_LOG_LEVEL=debug
    volumes:
      - netbird-client:/etc/netbird
    network_mode: host
    privileged: true

volumes:
  netbird-client:
    driver: local

Expected behavior

netbird status should be fetched and printed

Are you using NetBird Cloud?

self-host NetBird's control plane

NetBird version

latest, 0.28.4, 0.27.7

Originally created by @bravosierrasierra on GitHub (Jul 29, 2024). **Describe the problem** Can not access to netbird daemon from outside docker container. Daemon successfully started and registered in mesh with docker compose up -d But i am can not access to daemon stats and routes: $ docker compose exec netbird_client netbird --daemon-addr=unix:///var/run/netbird.sock status Error: failed to connect to daemon error: context deadline exceeded If the daemon is not running please run: netbird service install netbird service start $ docker compose exec netbird_client ls -laF /var/run/ total 8 drwxr-xr-x 2 root root 4096 Jun 18 15:37 ./ drwxr-xr-x 1 root root 4096 Jul 29 14:48 ../ ubuntu@netbird-gw-dev-dc-01 .../docker-compose/netbird $ **To Reproduce** use "docker compose up -d" and then "docker compose exec netbird_client netbird status" with this docker-compose.yaml: ``` services: netbird_client: image: "netbirdio/netbird:latest" restart: always logging: driver: local labels: logging: "promtail" logging_jobname: "containerlogs" container_name: netbird_client cap_add: - NET_ADMIN - SYS_ADMIN - SYS_RESOURCE environment: - NB_SETUP_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - NB_HOSTNAME=netbird-gw-dev-dc.domain.com - NB_SERVICE=netbird - NB_DAEMON_ADDR=unix:///var/run/netbird.sock - NB_MANAGEMENT_URL=https://mgmt.domain.com:33073 - NB_LOG_LEVEL=debug volumes: - netbird-client:/etc/netbird network_mode: host privileged: true volumes: netbird-client: driver: local ``` **Expected behavior** netbird status should be fetched and printed **Are you using NetBird Cloud?** self-host NetBird's control plane **NetBird version** latest, 0.28.4, 0.27.7
saavagebueno added the triage-needed label 2025-11-20 05:24:15 -05:00
Author
Owner

@itoffshore commented on GitHub (Jul 31, 2024):

I noticed the same issue under a privileged podman container / cloud hosted netbird

Maybe a good solution here would be to add a small function to detect if netbird is running in a container (query /proc/1/cgroup) - & if so skip the daemon check when querying status

@itoffshore commented on GitHub (Jul 31, 2024): I noticed the same issue under a privileged podman container / cloud hosted netbird Maybe a good solution here would be to add a small function to detect if `netbird` is running in a container (query `/proc/1/cgroup`) - & if so skip the daemon check when querying `status`
Author
Owner

@houckham commented on GitHub (Jan 19, 2025):

Netbird docker version 0.36.3 and still not able to poll netbird stats. Is this intended or a fault? Being worked on? Any work-arounds?

@houckham commented on GitHub (Jan 19, 2025): Netbird docker version 0.36.3 and still not able to poll netbird stats. Is this intended or a fault? Being worked on? Any work-arounds?
Author
Owner

@mojiefong commented on GitHub (Mar 13, 2025):

0.38.0 also has this problem

@mojiefong commented on GitHub (Mar 13, 2025): 0.38.0 also has this problem
Author
Owner

@azdolinski commented on GitHub (Mar 30, 2025):

workaround:

services:
  netbird:
    container_name: netbird
    hostname: netbird
    image: netbirdio/netbird:latest
    entrypoint: "netbird service run"             <<< !!!
    restart: always
    cap_add:
      - NET_ADMIN
      - SYS_ADMIN
      - SYS_RESOURCE
    environment:
      - NB_SETUP_KEY=${NB_SETUP_KEY}
      - NB_HOSTNAME=${NB_HOSTNAME}
      - NB_SERVICE=netbird
      - NB_LOG_LEVEL=info
    volumes:
      - ./netbird-client:/etc/netbird

Tested on:

root@host:/opt/docker/netbird# docker exec -it netbird sh
/ # netbird status
OS: linux/amd64
Daemon version: 0.39.2
CLI version: 0.39.2
...

in service mode you should be able to see inside docker /var/run/netbird.sock
by default - container starts in client mode so entrypoint: netbird up - in that case, there is no sock and will not be able to connect to service

@azdolinski commented on GitHub (Mar 30, 2025): workaround: ```yaml services: netbird: container_name: netbird hostname: netbird image: netbirdio/netbird:latest entrypoint: "netbird service run" <<< !!! restart: always cap_add: - NET_ADMIN - SYS_ADMIN - SYS_RESOURCE environment: - NB_SETUP_KEY=${NB_SETUP_KEY} - NB_HOSTNAME=${NB_HOSTNAME} - NB_SERVICE=netbird - NB_LOG_LEVEL=info volumes: - ./netbird-client:/etc/netbird ``` Tested on: ```bash root@host:/opt/docker/netbird# docker exec -it netbird sh / # netbird status OS: linux/amd64 Daemon version: 0.39.2 CLI version: 0.39.2 ... ``` in service mode you should be able to see inside docker `/var/run/netbird.sock` by default - container starts in client mode so `entrypoint: netbird up` - in that case, there is no sock and will not be able to connect to `service`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#1110