Docker Compose

For those of you running Linux servers or if you use docker-compose, then you can install Tailscale using our docker-compose.yml file example.

Before we create the compose file:

If your running Proxmox LXC then go to the following page before deploying the container :


Now let's create the first docker-compose.yml file with the nano text editor.

nano /opt/appdata/tailscale/docker-compose.yml
version: "2.4"
      privileged: true
      hostname: tailscale                                          # This will become the tailscale device name
      network_mode: "host"
      container_name: tailscale
      image: tailscale/tailscale:latest
          - "/opt/appdata/tailscale/var_lib:/var/lib"        # State data will be stored in this directory
          - "/dev/net/tun:/dev/net/tun"                      # Required for tailscale to work
      cap_add:                                               # Required for tailscale to work
        - net_admin
        - sys_module
      command: tailscaled
      restart: unless-stopped

After you're done editing the file, save it with ctrl+x, type “y” and then press enter.

Go here for the next step.

Proxmox LXC VPN Fix

This solution will fix any VPN you want to run such as Tailscale and OpenVPN

On the proxmox host look in /etc/pve/lxc/, for the ID of the LXC you want to use Tailscale in. For example in my case LXC ID=100. I would then edit /etc/pve/lxc/100.conf and add the following under what is already there:

lxc.cgroup.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file

This allows the container to have access to /dev/tun. In my case at least, this allows even an unprivileged LXC to run Tailscale or OpenVPN which makes a node.

Deploy the Container

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

docker-compose up -d

If you're in another directory, then you will need to specify the compose file with the -f argument.

docker-compose -f /opt/appdata/tailscale/docker-compose.yml up -d

Run the following to have the abilityfor your Host device to be the Exit Node

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

Now go here and run the section to enable IP forwarding and then your done!

Last updated