Every Dockerized service ships with `ports: ["8080:80"]` examples that publish the service to your host's LAN. Anyone on your home wifi can hit it; if you accidentally allow incoming on your router, the world can. The sidecar pattern fixes this: each container becomes its own tailnet device, reachable only over your tailnet, with no LAN exposure.
This is genuinely the answer for most "how do I get this Dockerized service onto my tailnet" questions. Same recipe, different service — once you've internalized the pattern, every container project becomes a copy-paste exercise.
https://ts-nginx.tail-abc.ts.netThe trick: the Tailscale sidecar and the nginx container share one network namespace via network_mode: service:ts-nginx. From the tailnet, ts-nginx is the device. nginx hears all the traffic on localhost — same thing, from its perspective. The host's LAN is on a separate path that's never published.
Run a Tailscale container as a sidecar to your service container. Both share a network namespace, so the service is reachable on the tailnet via the sidecar's tailnet identity — without ever publishing ports to your host's LAN. From the tailnet's perspective, the sidecar IS the service. From the service's perspective, the sidecar is just localhost.
Admin console → Settings → Auth keys → Generate auth key.
tag:container (declare in tagOwners first if needed)Copy the key. Looks like tskey-auth-XXXXX.
Save this as docker-compose.yml on your home server:
services:
ts-nginx:
image: tailscale/tailscale:latest
hostname: ts-nginx
environment:
- TS_AUTHKEY=${TS_AUTHKEY?required}
- TS_EXTRA_ARGS=--advertise-tags=tag:container
- TS_SERVE_CONFIG=/config/serve.json
- TS_STATE_DIR=/var/lib/tailscale
- TS_USERSPACE=false
volumes:
- ts-state:/var/lib/tailscale
- ./serve-config.json:/config/serve.json
- /dev/net/tun:/dev/net/tun
cap_add:
- net_admin
- sys_module
restart: unless-stopped
nginx:
image: nginx:alpine
network_mode: service:ts-nginx
depends_on:
- ts-nginx
restart: unless-stopped
volumes:
ts-state:
The key trick is network_mode: service:ts-nginx on the nginx container — it shares its network namespace with the Tailscale sidecar.
Save this as serve-config.json alongside the compose file:
{
"TCP": { "443": { "HTTPS": true } },
"Web": {
"${TS_CERT_DOMAIN}:443": {
"Handlers": { "/": { "Proxy": "http://127.0.0.1:80" } }
}
}
}
export TS_AUTHKEY="tskey-auth-XXXXX"
docker compose up -d
Check docker compose logs ts-nginx — you should see "Success." and the device's tailnet IP.
From any tailnet device, navigate to https://ts-nginx.tail-abc.ts.net. Nginx welcome page over HTTPS, valid cert. Check the admin console — ts-nginx appears as a tagged device.
Reuse the pattern. The shape is:
services:
ts-{name}:
image: tailscale/tailscale:latest
hostname: ts-{name}
# ... same Tailscale config ...
{name}:
image: {your-service-image}
network_mode: service:ts-{name}
# ... your service's config ...
Generate a fresh auth key per service. Adjust the Serve config to point to whatever port your service listens on (Jellyfin = 8096, Grafana = 3000, etc.). Done.
https://ts-nginx.tail-abc.ts.net loads from any tailnet device with a valid certts-nginx as a tagged devicedocker compose down followed by checking the admin console: the device removes itself (ephemeral)cap_add: [net_admin, sys_module] is set, or switch to TS_USERSPACE=true.network_mode: service:ts-{name} matches the sidecar's service key."AllowFunnel": {"${TS_CERT_DOMAIN}:443": true} to the serve config and ensure Funnel is enabled in your tailnet policy. The container goes public.TS_USERSPACE=true if you can't grant net_admin.The next Core project applies this pattern at full scale — engine + proxy + Tailscale sidecar all in one stack, with no host exposure of the underlying service.
Other natural follow-ups (every Featured Self-Hosted project uses this pattern):