Relay Last verified:

Run Relay with Docker

Deploy Viaalink Relay and Caddy reverse proxy using Docker Compose with automatic HTTPS.

Container deployment overview

New to Docker and the Relay? Lesson: install Viaalink Relay with Docker takes you through a first install in five steps, without Caddy.

The Viaalink Relay container image (ghcr.io/viaalink/relay, for amd64 and arm64) is public on the GitHub Container Registry: docker pull ghcr.io/viaalink/relay:latest (or a version tag such as 1.39.0). The same image is on Docker Hub as viaalink/viaalink-relay. On a Synology or QNAP NAS, see Run Relay on Synology or QNAP for the NAS-specific steps.

In production, running Viaalink Relay behind Caddy provides automatic Let’s Encrypt certificate issuance, wildcard subdomain management, and HTTP/3 support while Relay manages SSH reverse tunnels and routing.

Prerequisites

  • Docker Engine 24.0+ and Docker Compose v2.0+.
  • Domain with DNS pointing to your host server (see DNS Configuration):
    • relay.example.com (A / AAAA)
    • *.relay.example.com (A / AAAA or CNAME)
  • Open ports on your firewall or router: 80/tcp, 443/tcp, 2222/tcp, and optionally 3478/udp. This Compose file does not publish the call media port range 49152–49167/udp and sets no call relay realm or secret, so calls through firewalls do not work with it.

Deployment files

Create a dedicated directory on your server (for example /opt/viaalink-relay) containing the following configuration files:

bash

1. Caddy build with DNS-01 provider plugins (Dockerfile.caddy)

Issuing Let’s Encrypt wildcard certificates (*.relay.example.com) requires ACME DNS-01 validation. Because the stock caddy:2-alpine image does not bundle DNS provider plugins, build a small Caddy image with xcaddy including the five supported DNS providers:

Create Dockerfile.caddy:

dockerfile

2. Docker Compose file (docker-compose.yml)

Create docker-compose.yml. A license is activated on one machine, so the container needs the host’s machine ID. The line - /etc/machine-id:/run/host/machine-id:ro mounts it. First check that the host has one:

bash

If this says no machine ID, do not keep the mount: Docker then creates an empty folder in its place, and license activation fails. On a Linux server, create the ID with sudo systemd-machine-id-setup. On a NAS, use the network card with host networking instead, as described in Run Relay on Synology or QNAP. You can also pass an ID file with --host-id-file.

yaml

The network relay-net uses the fixed range 172.24.0.0/24, so the Relay knows Caddy’s address. If another Docker network on the host already uses that range, Compose cannot create the network. List the ranges in use with docker network ls and docker network inspect <name>. To use another free private range, change it in three places: subnet: in this file, VIAALINK_RELAY_TRUSTED_PROXIES in this file, and trusted-proxies: in data/config.yml.

3. Caddy reverse proxy configuration (Caddyfile)

Create Caddyfile in the same directory with the tls DNS-01 challenge block for your DNS provider (Cloudflare shown below):

nginx

4. Initial Relay configuration (data/config.yml)

Create data/config.yml:

yaml

Starting the stack

Build and start both containers in detached mode:

bash

Check the status of running containers:

bash

View the Relay server logs to verify startup and find the setup code:

bash

The setup code is in the line that starts with Setup dashboard token:. The Relay makes a new code each time it starts, so use the newest line. The code is also in data/license/setup-token.txt, which only root can read.

Open the setup dashboard at https://relay.example.com/_relay/dashboard?x-authorization=<setup-code>. This works once DNS, port forwarding, Caddy and its certificate are in place.

To sign in earlier from your own network, publish the Relay’s HTTP port: add - "8080:8080" under ports: of the relay service, run docker compose up -d, and open http://<server-ip>:8080/_relay/dashboard?x-authorization=<setup-code>. Do this only on a machine in your own network, never on a server with a public IP address, and do not forward port 8080 on your router. Remove the line again after setup.

Settings that need a restart make the Relay stop itself after a short delay; Docker’s restart: unless-stopped policy brings it back up. The dashboard shows a restart bar with options: Restart now, Tonight at …, or Undo. Restart now stops the Relay, and Compose starts it again. This is in Relay v1.36.0 and later, and in the ASUSTOR package 0.62.7 and later.

Settings in ./data/config.yml are overridden by the environment variables in this Compose file (VIAALINK_RELAY_DOMAIN, VIAALINK_RELAY_SSH_ADDRESS, and so on). A domain or port changed in the dashboard is written to config.yml but ignored after the restart. Keep domain and ports in config.yml only, and remove those variables from the Compose file if you want the dashboard to control them.

Persistent volumes and storage

All critical persistent state is preserved in the ./data directory on the host:

Host DirectoryContainer PathPurpose
/etc/machine-id/run/host/machine-idHost machine ID required for bound license activation
./data/keys//app/deploy/keysServer SSH private host keys (generated on first boot)
./data/pubkeys//app/deploy/pubkeysAuthorized client SSH public keys
./data/ssl//app/deploy/sslCustom SSL certificates and keys
./data/license//app/deploy/licenseLicense file (license.jwt) and setup-token.txt
./data/config.yml/app/config.ymlWritable Relay configuration file (updated by /_relay/dashboard)
caddy-data volume/dataCaddy Let’s Encrypt certificates and account keys

DNS-01 provider credentials

When configuring the tls { dns ... } directive in Caddyfile (or when Relay drives a bundled Caddy binary with --caddy-https-enabled=true), use the environment variables for your provider:

ProviderCaddyfile dns directiveEnvironment Variables
Porkbundns porkbun { api_key {env.PORKBUN_API_KEY} api_secret_key {env.PORKBUN_API_SECRET_KEY} }PORKBUN_API_KEY, PORKBUN_API_SECRET_KEY
Cloudflaredns cloudflare {env.CLOUDFLARE_API_TOKEN}CLOUDFLARE_API_TOKEN
AWS Route53dns route53 { access_key_id {env.AWS_ACCESS_KEY_ID} secret_access_key {env.AWS_SECRET_ACCESS_KEY} region {env.AWS_REGION} }AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION
DigitalOceandns digitalocean {env.DIGITALOCEAN_API_TOKEN}DIGITALOCEAN_API_TOKEN
GoDaddydns godaddy {env.GODADDY_API_TOKEN}GODADDY_API_TOKEN

Upgrading

To update Viaalink Relay and Caddy, pull the updated images and restart the containers:

bash

up -d alone does not fetch a newer image: the relay service uses the published image, so it needs pull first. Only the Caddy service is built locally.

Existing client connections will automatically reconnect when the new container starts.

Verifying health

Operational health is verified when:

  1. Port 2222 responds to SSH connections:
    bash
  2. Your browser reaches https://relay.example.com/_relay/dashboard or a published test application over HTTPS.

Next steps