subdy docs
Guides

Docker & Compose

Expose a containerized app on your subdomain with HTTPS.

At the end myapp.subdy.io serves your container over HTTPS.

Point the subdomain at your host's IP (dashboard or API), then put Caddy in front of your app:

compose.yml (Compose v2, Caddy 2.8)
services:
  app:
    image: ghcr.io/you/your-app:latest
    expose:
      - "3000"

  caddy:
    image: caddy:2.8
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data

volumes:
  caddy_data:
Caddyfile
myapp.subdy.io {
    reverse_proxy app:3000
}

docker compose up -d — Caddy obtains the certificate via HTTP-01 as soon as myapp.subdy.io resolves to this host.

Dynamic home IP

If the host sits behind a changing IP, add a dyndns side-car that calls the dyndns2 endpoint every 5 minutes:

compose.yml (fragment)
  dyndns:
    image: curlimages/curl:8.9.1
    command: >-
      sh -c 'while true; do
        curl -sS -u "you@example.com:$$SUBDY_TOKEN"
        "https://api.subdy.io/nic/update?hostname=myapp.subdy.io";
        sleep 300; done'
    environment:
      SUBDY_TOKEN: ${SUBDY_TOKEN}

Without myip the API uses the request's source address — exactly what you want behind NAT.

On this page