Caddy in Docker on Synology NAS

The Caddyfile has nothing to do with Docker port mappings. You need to make sure the Docker container has the right ports mapped. The Caddyfile only controls what Caddy does, inside the container. It cannot have any effect of what happens outside the container.

Your Caddyfile doesn’t really make sense. You’re exposing container ports 80 and 443, so those are the ports on which Caddy will accept requests. Your Caddyfile can probably simply be this:

mydomain.ddns.net {
  reverse_proxy 127.0.0.1:8096
}

Make sure that port 80 and 443 from outside your network eventually get routed to ports 80 and 443 on the container. If you need to use ports 8080 and 8443 at your router and on your machine before it reaches the container because your machine already uses ports 80/443, that’s also probably fine. But it’s important that ports 80/443 are used so that ACME challenges properly succeed.

2 Likes