abiosoft / caddy-docker

Docker container for Caddy
https://hub.docker.com/r/abiosoft/caddy/
MIT License
768 stars 315 forks source link

Local dns and external dns for container. #138

Closed psyciknz closed 6 years ago

psyciknz commented 6 years ago

I managed to get my certs coming from cloudflare after building in the cloudflare plugin.

If I run

sudo docker run -e CLOUDFLARE_EMAIL=email@example.com -e CLOUDFLARE_API_KEY=xxxxxxxxxxxxxxx -v /srv/caddy/Caddyfile:/etc/Caddyfile -v /srv/caddy/certs:/root/.caddy -p 80:80 -p 443:443  abiosoft/caddy

It quite happily gets the cert that I need, using 8.8.8.8 for dns. I tried my ISPs dns servers and it didn't seem to work but the proxy line

manwe.andc.nz {
        tls {
                dns cloudflare
        }

        log stdout
        errors stdout
        #not working
        proxy /hass http://drogo.andc.nz:8123/ {
             without /hass
             transparent
             insecure_skip_verify
        }
}

Can't find the local server.

Unless I start the docker with:

sudo docker run -e CLOUDFLARE_EMAIL=email@example.com -e CLOUDFLARE_API_KEY=xxxxxxxxxxxxxxx -v /srv/caddy/Caddyfile:/etc/Caddyfile -v /srv/caddy/certs:/root/.caddy -p 80:80 -p 443:443  --dns=192.168.10.1 abiosoft/caddy

which contains my router.

Should I be able to specify just my routers dns? but it might be getting confused since example.com is the local domain name

psyciknz commented 6 years ago

Resolved myself