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:

N/A

3. Caddy version:

v2.6.4 docker ghcr.io/mariomare22/caddy-dns:latest

4. How I installed and ran Caddy:

a. System environment:

#test
FROM caddy:2.6.4-builder AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare \
    --with github.com/hslatman/caddy-crowdsec-bouncer/http@main

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:

N/A

c. Service/unit/compose file:

version: "3.6"
services:
  authelia:
    container_name: "authelia-proxy"
    image: "authelia/authelia:latest"
    networks:
      - "caddy-proxy_local"
    restart: "unless-stopped"
    volumes:
      - "/mnt/nas/config/authelia/config:/config"
  
  caddy-dns:
    container_name: "caddy-dns-proxy"
    image: "ghcr.io/mariomare22/caddy-dns:latest"
    networks:
      - "internet"
      - "caddy-proxy_local"
    ports:
      - "443:443/tcp"
    restart: "unless-stopped"
    volumes:
      - "/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:

{
	acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
	email mmyemail
	log file-log {
		output file /var/log/caddy.log
	}
	crowdsec {
        api_url http://crowdsec:8080
        api_key crowdsecapi
        ticker_interval 15s
        #disable_streaming
        #enable_hard_fails
    }
	servers {
		trusted_proxies static 10.0.0.0/8 172.16.0.0/16
	}
}

(cloudflare) {
	tls {
		dns cloudflare myapikey
		resolvers 1.1.1.1
	}
}



# 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.