Docker compose - container infinitely restarting

1. Caddy version (caddy version):

caddy:2.4.2-builder

2. How I run Caddy:

a. System environment:

Ubuntu 20.04 LTS
DigitalOcean droplet
Docker 20.10.2
Both docker-compose.yml and Caddyfile located in ~/Caddy/

b. Command:

docker-compose up -d

c. Service/unit/compose file:

version: "3.7"

services:
  caddy:
    image: caddy:2.4.2-builder
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - .Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
      - caddy_config:/config

volumes:
  caddy_data:
  caddy_config:

d. My complete Caddyfile or JSON config:

7.synthfleshop.casa {
        reverse_proxy 127.0.0.1:8096
}

3. The problem I’m having:

When I use docker ps I can see the container is constantly restarting. I can’t docker exec into the container because of this also, nor can I reach https://7.synthfleshop.casa.

4. Error messages and/or full log output:

CONTAINER ID   IMAGE                 COMMAND     CREATED         STATUS                          PORTS     NAMES
2279e7444df1   caddy:2.4.2-builder   "/bin/sh"   2 minutes ago   Restarting (0) 36 seconds ago             caddy_caddy_1

5. What I already tried:

I’ve tried using different ports in Caddyfile and docker-compose.yml, different Caddy images, and using bind mounts instead of Docker-managed volumes.

6. Links to relevant resources:

https://hub.docker.com/_/caddy

The builder image variant is not meant to be used for running Caddy. It’s just an image which contains the build tools to make a custom build of Caddy. Please read the docs on Docker Hub.

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