SimpleACME
Sign inCreate account →
Containers

Certbot in Docker: persistent DNS-01 renewals with bind mounts

Keep Certbot certificates, account state and SimpleACME credentials across container recreation. Plan a repeatable DNS-01 renewal and deployment workflow.

A disposable container should not make certificate state disposable. Running Certbot in Docker can keep the client separate from an application, but the account, certificate lineage and renewal configuration must survive the container that performed the last run.

SimpleACME fits this model well. A permanent challenge CNAME connects the public DNS proof to an authenticated update endpoint, while the client container handles issuance and stores the resulting certificate in a host folder.

Decide what must persist

Use bind-mounted folders for Certbot's certificate, work and log directories. Protect the credential mapping separately and mount it only where the authentication hook needs it. A consuming application usually needs the certificate material, not the DNS update password.

Mount the complete certificate directory when the client uses symlinks between its live and archive paths. Mounting only a leaf file can leave the application with a broken link or an old inode after a renewal.

Build a client with the hook's dependencies

The standard client image may not contain every utility a custom hook uses. If the hook calls Bash, curl, jq or DNS tools, install those in a small reproducible client image rather than downloading arbitrary scripts every time the container starts.

Keep the hook's contract narrow: read the intended registration, send the supplied TXT authorization value, check the HTTP result and wait for DNS visibility. It should not need a Docker socket or administrative access to unrelated containers.

Separate validation from deployment

  1. Create and activate the SimpleACME domain and verify its challenge CNAME.
  2. Prepare host folders and a credential file readable only by the renewal identity.
  3. Build the client image with reviewed hook files.
  4. Run a staging certificate order with a separate test certificate name.
  5. Configure one renewal scheduler and an explicit deployment step.
  6. Test the certificate actually served by the consuming application.

An example renewal command is docker compose run --rm certbot renew --quiet. Run it from the intended project directory, using the same persistent folders and configuration as the initial order. Avoid overlapping schedules that compete for the same client state.

Keep the application boundary small

Give the application read-only access to the certificate folder when possible. Reload or restart it through a controlled deployment mechanism after a successful renewal. Do not hand the renewal container unrestricted access to the Docker daemon just to avoid designing that step.

Compared with maintaining a DNS-provider plugin and zone token inside the client image, SimpleACME provides one consistent DNS integration. The provider can change while the challenge CNAME and client configuration remain recognizable. The Certbot overview explains the public architecture; the subscriber Docker guide provides complete adaptable files.

KEEP EXPLORING

A little more clarity.

ONE CNAME. A REPEATABLE WORKFLOW.

Your next certificate. A little less complicated.

Keep your DNS provider and your ACME client.
Prepare your domain before activating paid updates.

Create your account →Explore the integrations