Skip to main content
NetBird can run inside Docker containers, enabling secure mesh networking for containerized applications. This is useful for connecting Docker containers across different hosts, accessing containers from your local machine, or integrating NetBird into CI/CD pipelines.

Quick Start

Run NetBird in a Docker container:

Docker Images

NetBird provides two Docker images:

Standard Image

Image: netbirdio/netbird:latest
  • Requires NET_ADMIN, SYS_ADMIN, and SYS_RESOURCE capabilities
  • Uses kernel WireGuard for better performance
  • Full feature set

Rootless Image

Image: netbirdio/netbird:latest-rootless
  • Runs as non-root user
  • Uses userspace WireGuard (netstack)
  • DNS disabled by default
  • Suitable for restricted environments

Installation

Standard Container

Rootless Container

For environments where elevated privileges are not available:
The rootless image:
  • Uses userspace WireGuard (slower than kernel WireGuard)
  • Has DNS disabled by default (NB_DISABLE_DNS=true)
  • Stores config in /var/lib/netbird instead of /etc/netbird
  • Runs as user netbird (non-root)

Docker Compose

Add NetBird to your docker-compose.yml:
Start the container:

Environment Variables

Configure NetBird using environment variables:

Common Variables

Daemon Configuration

Entrypoint Timing

Rootless-Specific Variables

Advanced Configuration

Required Capabilities

Standard Image

The standard NetBird image requires these Linux capabilities:
  • NET_ADMIN: Create and manage network interfaces (WireGuard)
  • SYS_ADMIN: Mount and manage network namespaces
  • SYS_RESOURCE: Adjust resource limits for WireGuard
Do NOT use --privileged unless absolutely necessary. The capabilities above are sufficient.

Rootless Image

The rootless image requires no special capabilities but has limited functionality:
  • Uses userspace WireGuard (lower performance)
  • Cannot manage system DNS settings
  • Cannot create kernel network interfaces

Networking Considerations

Host Network Mode

For optimal performance, consider using host networking:
Host networking bypasses Docker’s network isolation. Use with caution.

Custom Bridge Network

Connect NetBird to a custom Docker network:

Exposing Ports

If you need to expose specific ports from the container:

Volume Management

Persistent Storage

NetBird needs persistent storage for configuration and state:

Backing Up Configuration

Checking Container Status

Advanced Use Cases

Kubernetes/K8s

Run NetBird as a sidecar or DaemonSet in Kubernetes:

CI/CD Pipelines

Use NetBird in CI/CD to access private resources:

Multi-Container Setup

Share NetBird network with other containers:

Troubleshooting

Check if required capabilities are added:
Verify setup key is set:
Check container logs:
Verify NetBird status:
Check WireGuard interface:
For standard image, check DNS configuration:
For rootless image, DNS is disabled by default. Enable with:
Ensure required capabilities are added:
For rootless environments, use the rootless image:

Enable Debug Logging

Best Practices

Use Named Volumes

Store configuration in named Docker volumes for easy backup and portability.

Set Restart Policy

Use --restart unless-stopped to ensure NetBird survives container restarts.

Use Environment Variables

Store sensitive data like setup keys in .env files or secrets managers.

Monitor Logs

Regularly check logs for connection issues or errors.

Cleaning Up