1. The problem I’m having:
Hello! I’m trying to create a caddy2 docker image using a DNS provider module (cloudflare), but I’m unable to get the container running. I’m very new to caddy/docker/self-hosting, so I appreciate any help and patience.
Additional context:
I’m setting up a Jellyfin server and would like to reverse-proxy access through caddy so I can remotely access my local instance of Jellyfin and Jellyseerr through subdomains, jellyfin.kalen.io
and jellyseerr.kalen.io
, respectively.
2. Error messages and/or full log output:
Docker logs (docker logs --tail 30 --timestamps caddy-caddy-1
) outputs the below error code, repeating when the container attempts to restart every 60 seconds:
2024-01-31T03:21:59.074939074Z {"level":"info","ts":1706671319.0748045,"msg":"
using provided configuration","config_file":"/etc/caddy/Caddyfile","config_ada
pter":"caddyfile"}
2024-01-31T03:21:59.075133367Z Error: adapting config using caddyfile:
parsing caddyfile tokens for 'acme_dns': getting module named 'dns.providers.cloudflare':
module not registered: dns.providers.cloudflare, at /etc/caddy/Caddyfile:2
3. Caddy version:
2.7.6-alpine (Docker)
4. How I installed and ran Caddy:
a. System environment:
OS: Debian 12.4
Architecture: x86_64
Kernel: 6.1.0
Docker: v25.0.1, build 29cf629
b. Command:
I created the docker container using an image built from a Dockerfile. Here is the content of my Dockerfile:
FROM caddy:2.7.6-builder-alpine AS builder
RUN xcaddy build \
--with github.com/caddy-dns/cloudflare
FROM caddy:2.7.6
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
c. Service/unit/compose file:
This is the docker-compose.yml I ran after building the Dockerfile image:
version: "3.3"
services:
caddy:
image: caddy:2.7.6-alpine
build: .
security_opt:
- label:disable
- no-new-privileges:true
restart: unless-stopped
environment:
- PUID=3000
- PGID=3000
volumes:
- /home/kalen/caddy/Caddyfile:/etc/caddy/Caddyfile
- caddy-data:/data
- caddy-config:/config
ports:
- 80:80
- 443:443
volumes:
caddy-data:
caddy-config:
d. My complete Caddy config:
Here is my Caddyfile:
{
acme_dns cloudflare {REDACTED_CLOUDFLARE_API_TOKEN}
}
jellyfin.kalen.io {
reverse_proxy / 192.168.1.101:8096
}
jellyseerr.kalen.io {
reverse_proxy / 192.168.1.101:5055
}
I also tried using the line below instead of ‘acme_dns cloudflare’, though neither worked, and I’m not sure what the difference is.
tls {
dns cloudflare {REDACTED_CLOUDFLARE_API_TOKEN}
}
5. Links to relevant resources:
Guide to DNS modules:
Thread with a similar issue:
The remote access Jellyfin guide I roughly followed:
https://www.ethanmad.com/post/jellyfin_remote_access/
6. Conclusion
Any insight you can offer into this setup is greatly appreciated.
Thanks!!