DEV Community

Hasan Ali
Hasan Ali

Posted on

Join a Server to Tailscale Using Docker

Managing private servers securely doesn’t have to involve VPN gateways or complex firewall rules.

With Tailscale, you can drop a server into your private mesh network in minutes — and yes, it works great in Docker 🐳✨


🎯 Goal

  • 🕸️ Join a server to a Tailscale network
  • 🐳 Run Tailscale inside Docker
  • 🌐 Use host networking for full access
  • 🔐 Authenticate using a Tailscale auth key

🧾 Bash Script


bash
#!/usr/bin/env bash
set -euo pipefail

CONTAINER="tailscale"
IMAGE="tailscale/tailscale:v1.90.9"
TS_AUTHKEY="tskey-XXXX"

docker run -d \
  --name "$CONTAINER" \
  --network host \
  --cap-add NET_ADMIN \
  --cap-add SYS_MODULE \
  -e TS_AUTHKEY="$TS_AUTHKEY" \
  "$IMAGE"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)