Skip to content

Tailscale

Tailscale lets you easily manage access to private resources, quickly SSH into devices on your network, and work securely from anywhere in the world.

Create the first docker-compose.yml file with the nano text editor.

bash
nano /opt/appdata/tailscale/docker-compose.yml

Docker compose

yaml
version: "3"
services:
  tailscale:
    image: tailscale/tailscale:latest
    container_name: tailscale
    hostname: pi4
    network_mode: host
    environment:
      - TS_ROUTES=192.168.1.0/24
      - TS_AUTH_KEY=
    volumes:
      - /var/lib:/var/lib
      - /dev/net/tun:/dev/net/tun
    privileged: true
    restart: unless-stopped

Make sure you are in the same directory as the docker-compose.yml file, and now we want to start up the container by running the following:

bash
docker-compose up -d

Configuration

Once the container has started, find the link displayed in the logs to authenticate with your Tailscale account. Once added, your device will be connected.

Subnets

If you wish to broadcast a subnet - for example, to access other devices on the same network without installing a Tailscale client on them - you can advertise the common subnet 192.168.1.0/24 as a flag within the container.

To do this, add an environment variable of TS_ROUTES. In Compose this can be passed under a label:

yaml
    environment:
      TS_ROUTES: 192.168.1.0/24

Exit node

To use the Tailscale client as an Exit Node, run the following command to enable this feature. This will mean that all devices on the same Tailscale network will use this device as an Exit Node.

The term Exit Node is used by Tailscale as a device that all traffic is routed through. Essentially this would make the device a VPN server and your IP when browsing online would reflect that device's.

bash
docker exec tailscale tailscale up --advertise-exit-node

If you are using Compose, you will need to pass it as another environment variable called TS_TAILSCALED_EXTRA_ARGS:

yaml
    environment:
      TS_ROUTES: 192.168.1.0/24
      TS_TAILSCALED_EXTRA_ARGS: advertise-exit-node

Extra features

For further configuration, see the Docker Hub page for Tailscale. Here you can see a list of additional environment variables you can use.

A nest of technical knowledge.