Tailscale In Container
Manage Tailscale inside a container without enrolling the container host in the
tailnet.
Required Context
Read these files before acting:
references/rules/env.md
references/rules/filetree.md
references/rules/state-rules.md
references/tailscale-container-workflow.md
Reset STATE.md from references/template/STATE.template.md for a new run,
then record concrete evidence as each phase progresses.
Workflow
- Establish whether the target is Docker, Podman, LXC, or Kubernetes and
whether it is already running.
- Confirm the desired direction: cluster to container, container to cluster,
or both. Identify only the required protocols and ports.
- Inspect the container before mutation: distro, init system, installed
binaries, daemon state,
/dev/net/tun, Linux capabilities, state path, and
current Tailscale identity.
- For installation, verify the current commands against official Tailscale
documentation, install only inside the container, choose kernel or
userspace mode, authenticate without exposing secrets, and configure the
minimum required path.
- For removal, first determine whether the user wants a disconnect, package
uninstall with identity preserved, or complete removal. Treat state deletion
and tailnet device deletion as separate destructive actions.
- Validate the requested traffic path and confirm the host itself was not
enrolled or exposed.
Guardrails
- Do not install or authenticate Tailscale on the host unless explicitly asked.
- Do not use host networking for a container-only integration.
- A running container cannot gain new Docker capabilities or devices. If it
lacks
/dev/net/tun or NET_ADMIN, use userspace mode or explain that
transparent Layer 3 networking requires container recreation.
- Never print, persist in shell history, or commit an auth key. Prefer a secret
file, orchestrator secret, or interactive login URL.
- Do not publish host ports unless the user explicitly requests host access.
- Never delete
/var/lib/tailscale/tailscaled.state, a state volume, or the
tailnet machine record without explicit confirmation of complete removal.
- Do not stop unrelated processes. Resolve the exact
tailscaled PID or service
unit before stopping it.
Output
Report the selected networking mode, commands or changes made, connectivity
validation, host-isolation result, uninstall level if applicable, and any
restart or persistence limitation.
1---2name: tailscale-in-container3description: Install, start, integrate, diagnose, validate, stop, or uninstall Tailscale inside an existing Docker or LXC container while keeping the host out of the tailnet. Use for container-to-cluster connectivity, userspace networking, /dev/net/tun capability checks, Tailscale Serve, proxy access, and safe removal or complete cleanup.4---56# Tailscale In Container78Manage Tailscale inside a container without enrolling the container host in the9tailnet.1011## Required Context1213Read these files before acting:1415- `references/rules/env.md`16- `references/rules/filetree.md`17- `references/rules/state-rules.md`18- `references/tailscale-container-workflow.md`1920Reset `STATE.md` from `references/template/STATE.template.md` for a new run,21then record concrete evidence as each phase progresses.2223## Workflow24251. Establish whether the target is Docker, Podman, LXC, or Kubernetes and26 whether it is already running.272. Confirm the desired direction: cluster to container, container to cluster,28 or both. Identify only the required protocols and ports.293. Inspect the container before mutation: distro, init system, installed30 binaries, daemon state, `/dev/net/tun`, Linux capabilities, state path, and31 current Tailscale identity.324. For installation, verify the current commands against official Tailscale33 documentation, install only inside the container, choose kernel or34 userspace mode, authenticate without exposing secrets, and configure the35 minimum required path.365. For removal, first determine whether the user wants a disconnect, package37 uninstall with identity preserved, or complete removal. Treat state deletion38 and tailnet device deletion as separate destructive actions.396. Validate the requested traffic path and confirm the host itself was not40 enrolled or exposed.4142## Guardrails4344- Do not install or authenticate Tailscale on the host unless explicitly asked.45- Do not use host networking for a container-only integration.46- A running container cannot gain new Docker capabilities or devices. If it47 lacks `/dev/net/tun` or `NET_ADMIN`, use userspace mode or explain that48 transparent Layer 3 networking requires container recreation.49- Never print, persist in shell history, or commit an auth key. Prefer a secret50 file, orchestrator secret, or interactive login URL.51- Do not publish host ports unless the user explicitly requests host access.52- Never delete `/var/lib/tailscale/tailscaled.state`, a state volume, or the53 tailnet machine record without explicit confirmation of complete removal.54- Do not stop unrelated processes. Resolve the exact `tailscaled` PID or service55 unit before stopping it.5657## Output5859Report the selected networking mode, commands or changes made, connectivity60validation, host-isolation result, uninstall level if applicable, and any61restart or persistence limitation.