I have some basic experience with linux/docker/networking, and I am currently expanding my tiny homelab. Hugely grateful for any help in advance.
1. The problem I’m having:
I am trying to complete first configuration of Caddy, just “Hello, world!” from “Getting Started” documentaion for now, before I go into reverse-proxying all my other containers. After some troubleshooting after setting up, I managed to find that in order to set up ports in config, I need to add those in docker-compose.yaml, otherwise the connection is refused.
2. Error messages and/or full log output:
kaktus@raspi:/opt/docker/caddy $ curl http://raspi.kaktusland.xyz:2015/
curl: (7) Failed to connect to raspi.kaktusland.xyz port 2015 after 3 ms: Couldn't connect to server
3. Caddy version:
v2.11.2 h1:iOlpsSiSKqEW+SIXrcZsZ/NO74SzB/ycqqvAIEfIm64=
4. How I installed and ran Caddy:
a. System environment:
HW: Raspberry Pi 5 Model B Rev 1.0
OS: Debian GNU/Linux 12 (bookworm)
Kernel: 6.12.62+rpt-rpi-2712
Docker compose: v5.1.3
b. Command:
docker compose up -d
c. Service/unit/compose file:
services:
caddy:
container_name: caddy
image: caddy:latest
restart: unless-stopped
cap_add:
- NET_ADMIN
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./conf:/etc/caddy
- ./site:/srv
- caddy_data:/data
- caddy_config:/config
volumes:
caddy_data:
caddy_config:
d. My complete Caddy config:
:2015
respond "Hello, world!"
5. What i tried:
After adding port used to docker-compose.yaml so it looks like this:
services:
caddy:
container_name: caddy
image: caddy:latest
restart: unless-stopped
cap_add:
- NET_ADMIN
ports:
- "2015:2015"
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./conf:/etc/caddy
- ./site:/srv
- caddy_data:/data
- caddy_config:/config
volumes:
caddy_data:
caddy_config:
Works as expected:
kaktus@raspi:/opt/docker/caddy $ curl http://raspi.kaktusland.xyz:2015/
Hello, world!
This does not seem correct, and I suppose I need to change someting on OS level - but what? Or is it something else?