[GH-ISSUE #4320] How to set Wireguard to a fixed Port via DOCKER ENV? #8905

Closed
opened 2026-08-05 01:19:59 -04:00 by saavagebueno · 1 comment
Owner

Originally created by @robertpenz on GitHub (Aug 11, 2025).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/4320

Running Netbird via Docker on a Mikrotik Router I need to set the WireGuard Port to a fixed value so the p2p traffic from other clients go directly to the container without a relay - as the perimeter firewall blocks it otherwise .

Via CLI its netbird up --wireguard-port 51821 but for DOCKER I can't find a ENV variable, I tried NB_WIREGUARD_PORT but that does not work.

The biggest problem is that the ports are random and not as in iface.go DefaultWgPort = 51820.

Originally created by @robertpenz on GitHub (Aug 11, 2025). Original GitHub issue: https://github.com/netbirdio/netbird/issues/4320 Running Netbird via Docker on a Mikrotik Router I need to set the WireGuard Port to a fixed value so the p2p traffic from other clients go directly to the container without a relay - as the perimeter firewall blocks it otherwise . Via CLI its netbird up --wireguard-port 51821 but for DOCKER I can't find a ENV variable, I tried NB_WIREGUARD_PORT but that does not work. The biggest problem is that the ports are random and not as in iface.go DefaultWgPort = 51820.
saavagebueno added the triage-needed label 2026-08-05 01:19:59 -04:00
Author
Owner

@robertpenz commented on GitHub (Sep 18, 2025):

Found the solution, the ENV parameter is only used on the first startup or when the config directory was deleted.

<!-- gh-comment-id:3305906434 --> @robertpenz commented on GitHub (Sep 18, 2025): Found the solution, the ENV parameter is only used on the first startup or when the config directory was deleted.
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#8905