Using Caddy to replace the dockge service in Docker failed

I tried to deploy Caddy in Docker instead of using the Dockge service on port 5001. Dockge is a visual management panel for Docker Compose service

But it failed, no matter how I set it up, accessing my domain only displays Caddy’s default welcome interface Here are my Docker compose configuration file and Caddyfile to help analyze the issue.

caddy compose.yml

version: "3.7"
services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - $PWD/Caddyfile:/opt/stacks/caddy/Caddyfile
      - $PWD/site:/srv
      - caddy_data:/data
      - caddy_config:/config
volumes:
  caddy_data:
    external: true
  caddy_config: null
networks: {}

dockge yml

services:
  dockge:
    image: louislam/dockge:1
    restart: unless-stopped
    ports:
      # Host Port : Container Port
      - 5001:5001
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./data:/app/data

      # If you want to use private registries, you need to share the auth file with Dockge:
      # - /root/.docker/:/root/.docker

      # Stacks Directory
      # ⚠️ READ IT CAREFULLY. If you did it wrong, your data could end up writing into a WRONG PATH.
      # ⚠️ 1. FULL path only. No relative path (MUST)
      # ⚠️ 2. Left Stacks Path === Right Stacks Path (MUST)
      - /opt/stacks:/opt/stacks
    environment:
      # Tell Dockge where is your stacks directory
      - DOCKGE_STACKS_DIR=/opt/stacks
~

Caddyfile

dockge.example.com{
      tls xxx@qq.com
      reverse_proxy  localhost:5001 {
        trusted_proxies private_ranges
      }
}

Howdy @JIeJaitt, welcome to the Caddy community.

It looks like you might’ve mounted your new Caddyfile to the wrong location:

You’ve specified /opt/stacks/caddy/Caddyfile but Caddy looks by default in /etc/caddy/Caddyfile. Refer to the Docker hub documentation:

To override the default Caddyfile, you can mount a new one at /etc/caddy/Caddyfile:

$ docker run -d -p 80:80 \
    -v $PWD/Caddyfile:/etc/caddy/Caddyfile \
    -v caddy_data:/data \
    caddy

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

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