Running Netzilo in Docker
The Netzilo client is published as a container image for Linux on amd64 and arm64:
| Image | Runs as | Needs |
|---|---|---|
ghcr.io/netzilo/net-client:rootless-latest | an unprivileged user | nothing: no capabilities, no TUN device |
ghcr.io/netzilo/net-client:latest | root, kernel WireGuard and firewall | NET_ADMIN and /dev/net/tun |
Use the rootless image unless you have a reason not to. It runs where you have no admin rights on the host, on OpenShift and under restricted Kubernetes pod security. As a routing peer or exit node it relays the traffic itself, over ordinary connections of the container.
Each release is also tagged with its version: <version> and <version>-rootless.
Run the container
- In the dashboard, go to Endpoint > Setup Keys and create a setup key. For a routing peer or an exit node, make it add the peer to the group your route uses as routing peers.
- Run the container with that key:
docker run -d --restart=unless-stopped \
--name netzilo --hostname <peer-name> \
-e NZ_SETUP_KEY=<SETUP_KEY> \
-e NZ_MANAGEMENT_URL=https://<management-address> \
-v netzilo-client:/var/lib/netzilo \
ghcr.io/netzilo/net-client:rootless-latest
The same command, with your setup key and management address filled in, is in the dashboard under Endpoint > Peers > Add Peer > Docker.
The container appears under Endpoint > Peers with the name given by --hostname. Its log
shows the connection:
docker logs -f netzilo
Options
| Option | Meaning |
|---|---|
NZ_SETUP_KEY | Setup key that enrolls the container. Needed on the first start only. |
NZ_MANAGEMENT_URL | Address of your Netzilo management, for example https://srv.netzilo.com. |
NZ_LOG_LEVEL | info (default), debug or trace. |
--hostname | Peer name in the dashboard. Without it, the random container ID is used. |
-v netzilo-client:/var/lib/netzilo | Keeps the peer's identity (its key and configuration). |
Every client flag can be set the same way, as NZ_ and the flag name in upper case (see
CLI). The earlier NB_ names are still read.
The volume. netzilo-client is a Docker volume that Docker creates and manages;
/var/lib/netzilo is the path inside the container. With the volume, a restarted, recreated
or upgraded container comes back as the same peer. Without it, every new container enrolls
as a new peer. To keep the files in a host folder instead, use -v <host-folder>:/var/lib/netzilo;
the folder must be writable by user 1000 or group 0.
For short-lived containers, use an ephemeral setup key. A peer enrolled with it is removed 10 minutes after it goes offline, so containers that come and go leave nothing behind.
Routing peer or exit node
The container serves routes like any other peer. Create the setup key with an auto-assigned
group, for example docker-routers, start the container, then:
- Private network: create a route to the network with routing peer group
docker-routersand Masquerade on. See Routes. - Exit node: create a route to
0.0.0.0/0with routing peer groupdocker-routers. See Exit nodes.
Add a policy that lets the peers using the route reach docker-routers. The network or the
internet then sees the container's address as the source of the routed traffic.
The rootless image relays TCP, UDP and ICMP echo (ping). The kernel image forwards and translates packets in the kernel, which is faster for heavy traffic:
docker run -d --restart=unless-stopped \
--name netzilo --hostname <peer-name> \
--cap-add=NET_ADMIN --device /dev/net/tun \
--sysctl net.ipv4.ip_forward=1 \
-e NZ_SETUP_KEY=<SETUP_KEY> \
-e NZ_MANAGEMENT_URL=https://<management-address> \
-v netzilo-client-root:/etc/netzilo \
ghcr.io/netzilo/net-client:latest
The kernel image keeps its files in /etc/netzilo.
Docker Compose
services:
netzilo:
image: ghcr.io/netzilo/net-client:rootless-latest
hostname: <peer-name>
restart: unless-stopped
environment:
NZ_SETUP_KEY: <SETUP_KEY>
NZ_MANAGEMENT_URL: https://<management-address>
volumes:
- netzilo-client:/var/lib/netzilo
volumes:
netzilo-client:
Kubernetes and OpenShift
The rootless image runs with any user ID in group 0, all capabilities dropped and a
read-only root filesystem, so it fits OpenShift's restricted-v2 and Kubernetes' restricted
pod security. Mount a volume at /var/lib/netzilo. See
Routing peers and Kubernetes.
Upgrade
Pull the new image and recreate the container with the same volume:
docker pull ghcr.io/netzilo/net-client:rootless-latest
docker rm -f netzilo
# run the same docker run command again
The peer keeps its identity, so the setup key is not used again.
Troubleshooting
The container does not appear as a peer. Check docker logs netzilo for a refused setup
key or a wrong management address. A key used by more than one container must be reusable,
and must not be expired, revoked or at its usage limit.
Every restart creates a new peer. The container has no volume at /var/lib/netzilo
(/etc/netzilo for the kernel image).
Peers cannot reach the routed network. Check the policy from the peers using the route to the routing peer group, that the route is enabled and, for a private network, that Masquerade is on.
Related Documentation
- Install Netzilo - All platforms and installers
- Setup Keys - Reusable and ephemeral keys
- Routes - Network routes and routing peers
- Exit nodes - Internet traffic through a peer
- Routing peers and Kubernetes - Routing peers as pods

