Systemd stop caddy service without reason

I’m trying to run a caddy proxy (as docker container) through systemd. It’s working perfectly but sometimes systemd stop the service without any reason…

So I have these type of log

mai 07 14:47:00 server docker[2415]: 2019/05/07 14:47:00 [INFO]  - No such site at :80 (Remote:, Referer: )
mai 07 15:25:15 server systemd[1]: Stopping Caddy service which will proxy the kibana server...
mai 07 15:25:19 server docker[17301]: caddy-proxy-service
mai 07 15:25:19 server systemd[1]: caddy.service: Main process exited, code=exited, status=137/n/a
mai 07 15:25:20 server docker[17419]: caddy-proxy-service
mai 07 15:25:20 server systemd[1]: caddy.service: Failed with result 'exit-code'.
mai 07 15:25:20 server systemd[1]: Stopped Caddy service which will proxy the kibana server.

My caddy service

cat /etc/systemd/system/caddy.service
Description=Caddy service which will proxy the kibana server

ExecStartPre=/snap/bin/docker pull abiosoft/caddy
ExecStart=/snap/bin/docker run --name caddy-proxy-service --net=host -e ACME_AGREE=true -v /etc/caddy/Caddyfile:/etc/Caddyfile -v /etc/caddy/certs:/root/.caddy abiosoft/caddy
ExecStop=/snap/bin/docker kill caddy-proxy-service
ExecStopPost=/snap/bin/docker rm caddy-proxy-service
ExecReload=/snap/bin/docker restart caddy-proxy-service


So when I restart manually the caddy service, it doesn’t send any error and it’s working.

So do you know why Systemd stop my service like that ??

Thanks in advance for your help :wink:

Hi @dducatel, welcome to the Caddy community!

This kind of line means that Caddy quit out with an error.

Caddy’s logs should show more information. You can add -log stdout to the Caddy startup command, as well as the log stdout and errors stdout directives to your Caddyfile, to get more information logged.

Hi, the command line argument is already present by default (present in the dockerfile).
I have added the directives in my caddyfile. Now I have to wait the for the error hap pen again.


If you’ve already got -log stdout in your own Dockerfile, why aren’t you using your image based off that Dockerfile instead of pulling and running the default abiosoft/caddy image? Nevermind, it’s actually in Abiosoft’s Dockerfile.

Regardless, if it’s logging properly, check docker logs, Caddy should output an exit message there when it shuts down.

I used the abiosoft/caddy
Docker Hub → the CMD entry contains -log

Now I have the all the request logged in stdout so it seems to work.

The caddyfile is quiet easy in fact {

        tls {
            max_certs 10

        basicauth / toto toto

        proxy / {

        log stdout
        errors stdout

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.