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:
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: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:
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.