Add command to docker config to handle updates

1. Caddy version (caddy version):

v2.1.1

2. How I run Caddy:

caddy runs in a docker as a reverse proxy

a. System environment:

docker running on unraid

b. Command:

caddy run /caddy/caddyfile

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

{
        email email@domain.com
}

(theheaders) {
        header_up X-Forwarded-Ssl on
        header_up Host {host}
        header_up X-Real-IP {remote}
        header_up X-Forwarded-For {remote}
        header_up X-Forwarded-Port {server_port}
        header_up X-Forwarded-Proto {scheme}
        header_up X-Url-Scheme {scheme}
        header_up X-Forwarded-Host {host}
}
plexrequests.santech.xyz {
        encode gzip
        reverse_proxy http://192.168.0.17:3579 {
                import theheaders
        }
}

3. The problem I’m having:

when my docker updates i have to log in to the cli and manually run my caddy command to make caddy work again. i’m looking to see if there is a way for my docker config to handle that for me so i don’t have to handle on each update.

4. Error messages and/or full log output:

5. What I already tried:

6. Links to relevant resources:

Please remove these lines from your config, Caddy sets these headers for you automatically, so they are unnecessary. It’s likely that the rest of the upstream headers are not necessary either, but you’ll need to test that to make sure. See the reverse_proxy docs for more details:

Caddy has an official docker image that you can use instead of running it on your host machine: Docker Hub

I’ve removed those lines from my Caddyfile thank you! Can you tell me what i’m doing wrong though with my caddyfile? if i restart the container for any reason i have to go into the cli and run caddy reload --config /caddy/Caddyfile for it to work.

I’m guessing that maybe there’s something in my config that is incorrect?

here’s my container config

By default, the docker image looks for your config in /etc/caddy/Caddyfile. You probably want to make sure you mount a volume there instead for your config.

Also, don’t forget to make a volume for /data, otherwise you’ll lose your certificates and keys and you’ll possibly Let’s Encrypt hit rate limits.

Thank you! i can see that i’ve hit the too many cert errors for today so mapping the /data path should fix that. does the rest of my config look right to you?

Yeah, I think you should be good to go :+1:

This topic was automatically closed after 30 days. New replies are no longer allowed.