1. Output of caddy version
:
Can’t get this as Docker isn’t launching: caddy:2.6.2-builder-alpine
2. How I run Caddy:
Trying to run within docker-compose
a. System environment:
Docker: caddy:2.6.2-builder-alpine
b. Command:
docker-compose up --build
c. Service/unit/compose file:
version: "3.9"
services:
caddy:
container_name: caddy
image: caddy:2.6.2-builder-alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
environment:
- API_HOST=http://192.168.249.1
- API_PORT=8080
volumes:
- caddy_logging:/var/log/
- caddy_data:/data
- ./Caddyfile:/etc/caddy/Caddyfile
volumes:
caddy_logging:
caddy_data:
d. My complete Caddy config:
{
email test@realizesec.com
http_port 80
#https_port 443
log {
output file /var/log/access.log {
roll_size 1gb
roll_keep 5
roll_keep_for 720h
}
format json
level INFO
}
}
realizesec.com www.realizesec.com api.realizesec.com {
header {
Strict-Transport-Security max-age=31536000;
X-Content-Type-Options nosniff
X-Frame-Options DENY
Referrer-Policy no-referrer-when-downgrade
Content-Security-Policy: default-src 'self'
}
handle /api/* {
reverse_proxy {$API_HOST}:{$API_PORT}
}
}
3. The problem I’m having:
I am trying to run Caddy via docker-compose but it is exiting with code 0 immediately after attaching. So far as I can tell my setup is valid.
Summary
This text will be hidden
4. Error messages and/or full log output:
Paste logs/commands/output here.
➜ janusproxy git:(caddy_migration) ✗ docker-compose up --build
caddy is up-to-date
Attaching to caddy
caddy exited with code 0
5. What I already tried:
I have tried the following:
- Adding and removing HTTPS
- Switching environment variable formatting, i.e.
{$API_HOST}
vs{env.AP}
- Creating external networks
- Changing the reverse_proxy target to available hosts on the public internet
- Trimming down the Caddyfile to only include
reverse_proxy host:port
- Emulating ’ Docker Compose example’ example shown in Docker hub