Issues fronting Docker Swarm with Caddy

I was able to manually deploy Caddy in front of my Docker swarm and got it working without too much issue with the following Caddyfile

app.hostname.com {
    proxy / http://appname:3000
    tls {
        load /run/secrets/
    }
}

I’m feeding the cert/key pem files in with Docker Secrets and it picks them up and started just fine. However, if I build my own Docker image and include a more permanent and flexible Caddyfile:

{$HOSTNAME} {
    proxy / http://appname:3000
    tls {
        load /run/secrets/
    }
}

it doesn’t work. The log output indicates that it’s picking up the $HOSTNAME variable I’m passing in and shows the following:


Serving HTTPS on port 2015 
https://app.hostname.com:2015

2019/03/18 20:54:06 [INFO] Serving https://app.hostname.com:2015 
2019/03/18 20:54:06 [INFO][FileStorage:/root/.caddy] Started certificate maintenance routine

It’s as if it’s completely ignoring serving on 443/80. If I try hitting https://app.hostname.com:2015 nothing comes back. Any insight would be a life saver at this point. Thanks!

Are you saying that the server sends no response at all to these requests, i.e. timeout?

What, exactly, is the contents of $HOSTNAME when you run this?