DNS provider module in docker build 'not registered'

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  
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"
    image: caddy:2.7.6-alpine
    build: .
      - label:disable
      - no-new-privileges:true
    restart: unless-stopped
      - PUID=3000
      - PGID=3000
      - /home/kalen/caddy/Caddyfile:/etc/caddy/Caddyfile
      - caddy-data:/data
      - caddy-config:/config
      - 80:80
      - 443:443


d. My complete Caddy config:

Here is my Caddyfile:

  acme_dns cloudflare {REDACTED_CLOUDFLARE_API_TOKEN}

jellyfin.kalen.io {
	reverse_proxy /

jellyseerr.kalen.io {
	reverse_proxy /

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 {

5. Links to relevant resources:

Guide to DNS modules:

Thread with a similar issue:

The remote access Jellyfin guide I roughly followed:

6. Conclusion

Any insight you can offer into this setup is greatly appreciated.


I think if you have image it takes precedence over build so you’re never actually making the custom build. Just a guess.

This is wrong, path matching is exact in Caddy so / means “match exactly / and nothing else”. Remove that to match all paths.

Great! That worked. I completely removed the image: line from my docker compose file, and the container now builds successfully with the cloudflare module.

Hmmm. I must be misinterpreting what you mean. Can you clarify exactly what the Caddyfile should look like? So far every iteration I’ve tried is unsuccessful.

To be honest, the only reason I’ve made it this far is by browsing your many replies to a dozen other threads, so thanks for all the help here and on those posts!

Please read Request matchers (Caddyfile) — Caddy Documentation

You used a / matcher which only matches the path / but not /foo.

I got my syntax straightened out and figured out why none of the other (correct) iterations of my Caddyfile were working.

I had my A record in cloudflare for jellyfin.kalen.io pointing directly to Jellyfin’s Tailscale IP instead of Caddy’s Tailscale IP :man_facepalming:. I cannot believe how much time I wasted troubleshooting the wrong issue.

For posterity, here is my working Caddyfile:

  acme_dns cloudflare CLOUDFLARE_API_TOKEN

jellyfin.kalen.io {  
jellyseerr.kalen.io {  

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