Caddy in Docker - can another container read the certificates?

This line doesn’t make sense – you have two : in here.

It should probably look like:

volumes:
  - certs:/certs
env:
  - LDAP_TLS_CRT_FILENAME: "/certs/caddy/certificates/acme-v02.api.letsencrypt.org-directory/ldap.example.com/ldap.example.com.crt"
  - LDAP_TLS_KEY_FILENAME: "/certs/caddy/certificates/acme-v02.api.letsencrypt.org-directory/ldap.example.com/ldap.example.com.key"

Or something along those lines.

Either way, this isn’t a problem with Caddy, this is more of a Docker or OpenLDAP question.

You should be aware, Caddy has issuer fallback so it won’t necessarily get a cert from Let’s Encrypt. If there’s a problem with LE, then it might get a cert from ZeroSSL instead, in which case the directory would change.

So relying on the file path like that isn’t really recommended. You could turn off zerossl by explicitly specifying issuer acme in your tls config, but I don’t recommend that either because it worsens the robustness of cert issuance.

I’m working on an event dispatching system for Caddy which should eventually make it possible to copy certs for a domain to a well-known location when a cert is issued or renewed, but I don’t have a timeline for when it’ll be ready.

2 Likes