Compile ESPHome remotely on Hetzner using Docker and Tailscale
Posted on June 19, 2026 | Reading time 3 minutesWarning Exposing ESPHome will allow connected devices to run commands remotely. In this setup, ESPHome is exposed to a Tailscale Network only. When changing your configuration you should always use safe passwords and make sure to not expose your service accidentally!
You can find the code also on GitHub at https://github.com/ChrisK91/docker-esphome-tailscale
Prerequisites
- You need a Server with Docker running. I’m running a small IPv6-only server on Hetzner. Running an IPv6-Only server requires additional configuration steps
- IPv6: Configure docker to use IPv6 networks by editing/creating your
/etc/docker/daemon.json-file1 2 3 4 5 6{ "ipv6": true, "fixed-cidr-v6": "fd00::/80", "experimental": true, "ip6tables": true }/etc/docker/daemon.json
- IPv6: Configure docker to use IPv6 networks by editing/creating your
- Install the Tailscale add-on to homeassistant
- You can disable the Exit Node if you don’t want to route internet through your homeassistant device
- You must disable
Userspace networking modeor ESPHome will be unable to reach your tailscale devices - After starting the add-on check the log to authenticate the new device
Docker Setup
You can download or manually create the required files. When running an IPv6-only server it might be easier to upload them manually as long as GitHub is still IPv4 only. Otherwise you can run curl https://raw.githubusercontent.com/ChrisK91/docker-esphome-tailscale/refs/heads/main/.env > .env and curl https://raw.githubusercontent.com/ChrisK91/docker-esphome-tailscale/refs/heads/main/compose.yml > compose.yml to download the files.
Get a Auth-Key from the Tailscale admin panel and add it to your .env file.
On Hetzner IPv6-only you need to uncomment the IPv6 related entries in the compose.yml which results in the final file as follows:
| |
Finally start your container with docker compose up -d and verify that the tailscale-esphome and homeassistant device are connected in your Tailscale dashboard. Note down your ip from the dashboard!
Configuring ESPHome
Connect to your remote device either via the IP noted above or via http://tailscale-esphome:6052 and head to Settings. Go to Pairing Requests. Leave the screen open.
On your Home Assistant ESPHome dashboard head to Settings -> Send builds and click Pair with a build server. Enter the Tailscale IP from above. You will see a request popping up on the remote dashboard (at http://tailscale-esphome:6052). Compare the emojis and pair the device.
That’s it. After pairing, builds can be sent to the remote server. Happy building!