Running Caddy with Docker
The official caddy image runs the server out of the box. The command above publishes ports 80 and 443 and persists certificates in the named volume caddydata mounted at /data. Verify with docker exec caddy caddy version.
Providing a Caddyfile
Mount your configuration over the default path: -v $(pwd)/Caddyfile:/etc/caddy/Caddyfile. After editing it, apply changes with docker exec caddy caddy reload --config /etc/caddy/Caddyfile — no container restart required.
Persisting certificates
Caddy stores issued TLS certificates and state under /data. Always mount it on a volume (caddydata above); otherwise every container recreation re-issues certificates and can hit the certificate authority's rate limits.