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
}
}