GuidesSecurity

Tailscale in a container: /dev/net/tun does not exist, the fixes

CreateTUN("tailscale0") failed; /dev/net/tun does not exist: the server is a container. How to check, the fix for LXC, OpenVZ and Docker, and userspace mode.

November 18, 2026The Everpod team
The short answer

CreateTUN("tailscale0") failed; /dev/net/tun does not exist means tailscaled could not create its network interface because the machine has no TUN device, which usually means the server is a container (an LXC or OpenVZ VPS, a Proxmox LXC, a Docker container), not a virtual machine. tailscaled then exits, so every tailscale command after it says “failed to connect to local tailscaled; it doesn’t appear to be running”. A container cannot create the device for itself: whoever runs the host passes /dev/net/tun in (the Proxmox host, the VPS provider, whoever starts the Docker container), or you start tailscaled with --tun=userspace-networking, which needs no device but makes this machine’s own connections to the tailnet go through a local proxy.

The two messages, and which one is the cause

The first is in tailscaled’s own log, the second is what the tailscale CLI prints afterwards. As of release 1.104.7 (November 2026), the TUN failure comes from the WireGuard library Tailscale uses, wrapped by tailscaled; put together from the source’s format strings, the log line reads:

wgengine.NewUserspaceEngine(tun "tailscale0") error:
  tstun.New("tailscale0"): CreateTUN("tailscale0") failed;
  /dev/net/tun does not exist
Copied

Before it, tailscaled tries modprobe tun and logs what it finds, so a container’s log usually also carries “is CONFIG_TUN enabled in your kernel? `modprobe tun` failed with: …”. In a container that hint points the wrong way: the kernel belongs to the host, and nothing done inside the container loads a module into it. After the failure the daemon stops, and on a systemd server its unit has Restart=on-failure, so it fails again on every restart. Read it with:

sudo journalctl -u tailscaled -n 50
Copied

When the device node is present but the container is not allowed to open it, the same line ends in the system’s own error, such as operation not permitted, instead of “does not exist”. The cause is the same and so is the fix.

The CLI message has three forms on Linux, chosen by whether a tailscaled process is running and whether its socket exists:

Is this server a container?

A VPS sold as OpenVZ or LXC shares its host’s kernel, and so does a container on a KVM machine. Three checks settle it:

systemd-detect-virt -c
cat /run/systemd/container
ls -l /dev/net/tun
Copied

systemd-detect-virt -c names the container technology, among them openvz, lxc, docker and podman, and exits non-zero when the machine is not a container, per its manual. /run/systemd/container exists only where systemd is running inside a container, and holds the same kind of name. Where neither tool is there, systemd’s container interface says to look for container= in PID 1’s environment; this prints only that variable, because the rest of PID 1’s environment can hold keys:

sudo grep -z '^container=' /proc/1/environ | tr '\0' '\n'
Copied

Setting the variable is up to the container runtime, so an empty answer does not prove the machine is not a container. The last check is the one that matters for Tailscale: ls: cannot access '/dev/net/tun' means the device is missing, and a character device with numbers 10, 200 means it is there.

Proxmox LXC: the host passes the device

On Proxmox, the change is made on the Proxmox host, in the container’s config file, then the container is restarted. Tailscale’s LXC page gives these lines for Proxmox 7, in /etc/pve/lxc/<id>.conf:

lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
Copied

Proxmox 6 and earlier use lxc.cgroup.devices.allow in the first line. The same page gives the command form, run on the host:

pct set <id> --dev0 /dev/net/tun
Copied

The first line allows the container to use device 10:200 and the second puts the host’s node inside it; missing the first is how a container ends up with the node and a permission error. With both in place, tailscaled runs in its normal mode and nothing else changes.

A container VPS: only the provider can enable TUN

On an OpenVZ or LXC plan, the host is the provider’s. OpenVZ’s own documentation grants a container the device “by running the following commands on the host node”, vzctl set $CTID --devnodes net/tun:rw --capability net_admin:on --save, which no command inside the VPS can do. Ask the provider’s support to enable TUN for the server; whether they do is their decision, and if they will not, use userspace networking below. An agent box that should run any VPN, Docker networking or system services the way a laptop does is better on a plan that is a real virtual machine (KVM, or the provider’s own hypervisor), which choosing a VM for AI agents weighs against the alternatives.

Docker: the official image, or the device

A Docker container gets no /dev/net/tun unless it is given one. Tailscale’s image tailscale/tailscale avoids the question by default: its TS_USERSPACE setting is “Enabled by default. This is equivalent to tailscaled --tun=userspace-networking.” So the TUN error from that image means TS_USERSPACE=false was set without the device. Kernel networking “requires /dev/net/tun and additional capabilities”; in Compose, the capabilities are from Tailscale’s Compose how-to and the device line from Tailscale’s Docker guide:

services:
  tailscale:
    image: tailscale/tailscale:latest
    environment:
      - TS_AUTHKEY=<tskey-YOUR-AUTH-KEY>
      - TS_STATE_DIR=/var/lib/tailscale
      - TS_USERSPACE=false
    volumes:
      - ./tailscale-state:/var/lib/tailscale
    devices:
      - /dev/net/tun:/dev/net/tun
    cap_add:
      - net_admin
      - net_raw
Copied

The device is the host’s, so this only works where the Docker host itself has /dev/net/tun: Docker inside an OpenVZ or LXC VPS is back to the provider question. Keep the state directory on a volume; the docs warn that without it the container registers as a new machine each time it starts. If the agent runs on a VM with Docker, installing Tailscale on the VM itself rather than in a container avoids all of this.

Userspace networking, and what it changes

Userspace networking “lets you run Tailscale where you don’t have access to create a VPN tunnel device”. On a server where tailscaled runs under systemd, set the flag in /etc/default/tailscaled, which the service reads, adding a SOCKS5 and HTTP proxy if programs on this machine need to reach the tailnet:

FLAGS="--tun=userspace-networking --socks5-server=localhost:1055 --outbound-http-proxy-listen=localhost:1055"
Copied

Then sudo systemctl restart tailscaled and sudo tailscale up. In a container with no service manager, Tailscale’s page starts the daemon in the background directly:

tailscaled --tun=userspace-networking \
  --socks5-server=localhost:1055 \
  --outbound-http-proxy-listen=localhost:1055 &
tailscale up --auth-key=<your-auth-key>
Copied

Started that way, nothing restarts it after a reboot or a crash; on an agent server that has to stay reachable, that is a job for whatever starts the container’s other processes.

The machine joins the tailnet as usual and shows in the admin console, but there is no tailscale0 interface. What that means, as far as Tailscale’s docs say:

For an agent that you reach over Tailscale and that otherwise talks only to the public internet, none of these limits come into play, since its internet traffic does not pass through Tailscale unless it uses an exit node. It is the agent’s own connections to your other machines that need the proxy, and a program that does not support proxy settings cannot make them.

A machine where tailscaled does start but tailnet traffic still goes nowhere has a different problem; when another VPN is on the same machine, see Tailscale and WireGuard on one machine.

Run Claude Code, Codex, OpenCode, Pi, Hermes or OpenClaw on an always-on developer pod.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.