From 7758a19be45850794024a6818b8d2c893a104c42 Mon Sep 17 00:00:00 2001 From: Jordan Russell Date: Wed, 17 Sep 2025 13:38:57 +1200 Subject: [PATCH] feat: include stopped containers for creation/renewal Enables toggling the -include-stopped flag in docker-gen with the `INCLUDE_STOPPED` environment variable to enable certificate creation/renewal (and avoiding certificate/symlink removal) for stopped containers. --- app/start.sh | 6 +++++- docs/Container-configuration.md | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/start.sh b/app/start.sh index 94db50f4..4e90974f 100755 --- a/app/start.sh +++ b/app/start.sh @@ -20,7 +20,11 @@ letsencrypt_service_pid=$! wait_default="5s:20s" DOCKER_GEN_WAIT="${DOCKER_GEN_WAIT:-$wait_default}" -docker-gen -watch -notify '/app/signal_le_service' -wait "$DOCKER_GEN_WAIT" /app/letsencrypt_service_data.tmpl /app/letsencrypt_service_data & +if parse_true "${INCLUDE_STOPPED:=false}"; then + docker-gen -watch -include-stopped -notify '/app/signal_le_service' -wait "$DOCKER_GEN_WAIT" /app/letsencrypt_service_data.tmpl /app/letsencrypt_service_data & +else + docker-gen -watch -notify '/app/signal_le_service' -wait "$DOCKER_GEN_WAIT" /app/letsencrypt_service_data.tmpl /app/letsencrypt_service_data & +fi docker_gen_pid=$! # wait "indefinitely" diff --git a/docs/Container-configuration.md b/docs/Container-configuration.md index 8465054a..a302bcb0 100644 --- a/docs/Container-configuration.md +++ b/docs/Container-configuration.md @@ -40,3 +40,4 @@ You can also create test certificates per container (see [Test certificates](./L * `RELOAD_NGINX_ONLY_ONCE` - The companion reload nginx configuration after every new or renewed certificate. Previously this was done only once per service loop, at the end of the loop (this was causing delayed availability of HTTPS enabled application when multiple new certificates where requested at once, see [issue #1147](https://github.com/nginx-proxy/acme-companion/issues/1147)). You can restore the previous behaviour if needed by setting the environment variable `RELOAD_NGINX_ONLY_ONCE` to `true`. +* `INCLUDE_STOPPED` - Whether to include stopped containers when generating certificates. Useful for when the **nginx-proxy** container might need to serve a valid page for offline containers. \ No newline at end of file