Docker container built with plugins issue

1. The problem I’m having:

I am mounting the /data folder to persist certificates but the actual data is stored in /root/.local/share/caddy

2. Error messages and/or full log output:


3. Caddy version:

v2.6.4 docker

4. How I installed and ran Caddy:

a. System environment:

FROM caddy:2.6.4-builder AS builder

RUN xcaddy build \
    --with \

FROM caddy:2.6.4-builder

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]

b. Command:


c. Service/unit/compose file:

version: "3.6"
    container_name: "authelia-proxy"
    image: "authelia/authelia:latest"
      - "caddy-proxy_local"
    restart: "unless-stopped"
      - "/mnt/nas/config/authelia/config:/config"
    container_name: "caddy-dns-proxy"
    image: ""
      - "internet"
      - "caddy-proxy_local"
      - "443:443/tcp"
    restart: "unless-stopped"
      - "/home/mario/config/caddy/caddyfile:/etc/caddy"
      - "/home/mario/config/caddy/data:/data"
      - "/home/mario/config/caddy/config:/config"
      - "/home/mario/config/caddy/log:/var/log"

d. My complete Caddy config:

	email mmyemail
	log file-log {
		output file /var/log/caddy.log
	crowdsec {
        api_url http://crowdsec:8080
        api_key crowdsecapi
        ticker_interval 15s
	servers {
		trusted_proxies static

(cloudflare) {
	tls {
		dns cloudflare myapikey

# Authelia Portal.
autheliamydomain {
	import cloudflare
	reverse_proxy authelia:9091

5. Links to relevant resources:

Please completely fill out the help topic template, as per the forum rules.

Sorry, Done!

This is your problem, you shouldn’t do FROM the builder image for the second step. You’re meant to use the alpine image as your actual base for running Caddy.

Please look at the docs on Docker Hub.

You should probably also add - "80:80" and - "443:443/udp"

Port 80 is used for setting up HTTP->HTTPS redirects so that you don’t have to type https:// in the browser, and UDP is for HTTP/3.

roger that! just recompiled and it worked just fine.

I am not opening 80 port on firewall since I am doing DNS certs validation to cloudflare and i don’t really care about redirect.

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