Quick Start

Before you start

  • The Docker host is on your tailnet and tagged tag:server (sudo tailscale up --advertise-tags=tag:server --reset). On macOS, Windows and many NAS devices, use the Tailscale sidecar instead.
  • Your tailnet policy lists tag:server and tag:container (the default service tag) in tagOwners, and autoApprovers.services lets tag:server advertise tag:container services. See ACL Configuration.
  • Recommended: a Tailscale OAuth client for tag:server with Services: Write and Devices Core: Write (plus Keys Auth Keys: Write for the sidecar). No broader scope, such as all, is needed. Without credentials, you create each service in the admin console yourself. See OAuth Credentials.
Policy snippet (tagOwners + autoApprovers)
{
  "tagOwners": {
    "tag:server": ["autogroup:admin"],
    "tag:container": ["tag:server"]
  },
  "autoApprovers": {
    "services": {
      "tag:container": ["tag:server"]
    }
  }
}

Run it

Then add DockTail to your Docker Compose file alongside the service you want to expose:

services:
  docktail:
    image: ghcr.io/marvinvr/docktail:latest
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /var/run/tailscale:/var/run/tailscale
    environment:
      # Optional but recommended. Enables automatic service creation.
      - TAILSCALE_OAUTH_CLIENT_ID=${TAILSCALE_OAUTH_CLIENT_ID}
      - TAILSCALE_OAUTH_CLIENT_SECRET=${TAILSCALE_OAUTH_CLIENT_SECRET}

  myapp:
    image: nginx:latest
    # No ports needed. DockTail proxies directly to the container IP.
    labels:
      - "docktail.service.enable=true"
      - "docktail.service.name=myapp"
      - "docktail.service.port=80"

Start the stack:

docker compose up -d

Then open the service from your tailnet:

curl http://myapp.your-tailnet.ts.net

The first time a service is advertised, it may need approval in the Tailscale Admin Console's Services tab; see Approve Services. If it does not show up, docker compose logs docktail names the cause, and Installation and Tailscale Admin Setup cover each step in detail. On macOS and Windows the host's Tailscale daemon cannot be shared with containers, so use the Tailscale Sidecar setup instead. Rootless Docker on Linux needs an extra operator step; see Rootless Docker. For Podman, Synology, Unraid, TrueNAS, Swarm and Kubernetes, see the Platform Guides.