this post was submitted on 23 Jun 2026
9 points (90.9% liked)

Selfhosted

60074 readers
635 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam.

  3. Posts here are to be centered around self-hosting. Please ensure it is clear in your post how it relates to self-hosting.

  4. Don't duplicate the full text of your blog or git here. Just post the link for folks to click.

  5. Submission headline should match the article title.

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

I'm looking into setting up https for my local services. Everything is currently set up using the official caddy docker image.

I want to use now connect caddy to cloudflare to resolve the DNS 01. It looks like this is possible with a drop in replacement for caddy from either https://github.com/CaddyBuilds/caddy-cloudflare or https://github.com/serfriz/caddy-custom-builds

Is anyone here using these builds? Are they reliable? Is there an alternative I havent considered?

top 8 comments
sorted by: hot top controversial new old
[–] ryper@lemmy.ca 5 points 5 hours ago (2 children)

You could just build it yourself, there's not much to it.

Dockerfile:

ARG VERSION=2

FROM caddy:${VERSION}-builder AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare

FROM caddy:${VERSION}

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

My Dockerfile is under dockerfile-dns and then in docker-compose.yaml instead of pointing to an image I have:

services:
  caddy:
    build: ./dockerfile-dns

I'm not 100% sure of the right way to update it, but I think I usually use something like docker compose build --pull --no-cache.

[–] anytimesoon@piefed.social 2 points 4 hours ago (1 children)

This is basically the dockerfile these projects provide, so I guess I could do this myself. How do you keep the caddy container up to date? I have tugtainer (something like watchtower) update caddy automatically, but I guess this set up would break that

[–] ryper@lemmy.ca 2 points 4 hours ago

I can't help you with automation. I update my containers manually, whenever I think to do it. Nothing is accessible outside my network so I'm not worried about staying on top of security updates.

[–] hellmo_luciferrari@lemmy.zip 1 points 4 hours ago* (last edited 4 hours ago)

I have a Dockerifle like that:

ARG CADDY_VERSION=2.11.3
FROM caddy:${CADDY_VERSION}-builder-alpine AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare

FROM caddy:${CADDY_VERSION}-alpine

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

and the docker-compose.yml file I use:

services:
  caddy:
    pull_policy: build
    build:
      context: .

And to build new versions I modify the Dockerfile after doing a docker compose down, and then to build the new version I use docker compose up.

[–] hellmo_luciferrari@lemmy.zip 2 points 4 hours ago (1 children)

I currently build my own Caddy docker container with a Dockerfile using xcaddy and the caddy-builder-alpine image.

xcaddy adds these github.com/caddy-dns/cloudflare github.com/lucaslorentz/caddy-docker-proxy/v2

[–] anytimesoon@piefed.social 1 points 4 hours ago (1 children)

That seems like a good option. How do you keep it updated?

[–] hellmo_luciferrari@lemmy.zip 1 points 4 hours ago* (last edited 4 hours ago) (1 children)

I have a Dockerifle:

ARG CADDY_VERSION=2.11.3
FROM caddy:${CADDY_VERSION}-builder-alpine AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare

FROM caddy:${CADDY_VERSION}-alpine

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

and the docker-compose.yml file I have this snippet at the top, of course this isn't the full file as there are specifics to my usecase in my full yml:

services:
  caddy:
    pull_policy: build
    build:
      context: .

And to build new versions I modify the Dockerfile after doing a docker compose down, and then to build the new version I use docker compose up.``


Though this is outdated for my current setup, as I also use github.com/lucaslorentz/caddy-docker-proxy by adding "--with github.com/lucaslorentz/caddy-docker-proxy/v2" below where I added the Cloudflare repo.

This is so I can use Docker Labels to to automate entries.

Note that the (non-windows) caddy and caddy: builder images are all alpine based. The "-alpine" tags point to the same images (as you can tell by the hashes). But some like to be explicit about it 💜.