Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Tailscale

Runs a Tailscale node inside a container, advertising subnet routes and acting as an exit node for your tailnet.

https://tailscale.com/docs/features/containers/docker

Overview

Setting Value
Image tailscale/tailscale:latest
Network mode Dedicated Docker bridge network with net_admin + /dev/net/tun
Exit node Enabled (--advertise-exit-node)
Subnet routes 10.0.0.0/20 (configurable)
State /mnt/SSD/Containers/tailscale

Prerequisites

  • A Tailscale account and tailnet
  • An auth key from the Tailscale admin console
  • /dev/net/tun available on the host (standard on Linux)
  • Upstream DNS servers 10.0.6.2 and 10.0.6.3 reachable from the Docker host, or adjust the dns: entries in compose.yaml

Quick Start

1. Copy the environment template

cp .env.example .env

2. Edit the .env file

nano .env
Variable Required Description
TS_AUTHKEY Yes Auth key from the Tailscale admin console
TS_HOSTNAME No Node name in the admin console (default: homelab)
TS_EXTRA_ARGS No Extra flags passed to tailscale up
TS_ROUTES No Subnet routes to advertise (default: 10.0.0.0/20)

3. Create the state directory

mkdir -p /mnt/SSD/Containers/tailscale

4. Deploy

docker compose up -d

5. Approve subnet routes

After the first successful connection, go to the Tailscale admin console, find the node, and approve the advertised subnet routes.

Auth Key Types

Type When to use
Reusable auth key Simple setup; node registered under your user account
OAuth client secret Preferred for long-running containers; does not expire

Generate keys at login.tailscale.com/admin/settings/keys.

Exit Node

This container advertises itself as a Tailscale exit node. To use it, select it in the Tailscale client on any device in your tailnet under Use exit node.

Storage

Data Path
Tailscale state /mnt/SSD/Containers/tailscale

State includes the node key and registration — preserving it avoids re-authentication on container restarts.

Maintenance

Update image

docker compose pull
docker compose up -d

Re-authenticate

If the node loses authentication, delete the state directory and redeploy:

docker compose down
rm -rf /mnt/SSD/Containers/tailscale/*
docker compose up -d