From 72bb679be0cceb9646e4609df1731840a876de52 Mon Sep 17 00:00:00 2001 From: ks72 <20420826+ks72@users.noreply.github.com> Date: Fri, 7 Aug 2026 16:48:00 +0200 Subject: [PATCH] fix(time): expand LOCAL_TIMEZONE in Docker ENTRYPOINT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Exec-form ENTRYPOINT does not invoke a shell, so "${LOCAL_TIMEZONE}" was never expanded — it reached mcp-server-time as the literal string "${LOCAL_TIMEZONE}" on every run, regardless of what -e LOCAL_TIMEZONE was set to. That string is truthy, so get_local_tz() always took the override branch and called ZoneInfo("${LOCAL_TIMEZONE}"), which raises ZoneInfoNotFoundError. The container exits 1 on startup every time, whether or not the caller sets the variable — the feature added in #640 has never worked. Verified against the published Dockerfile: # before, docker run --rm -e LOCAL_TIMEZONE=Europe/Paris mcp/time zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key ${LOCAL_TIMEZONE}' exit 1 # after, identical command exit 0 Switched to shell-form ENTRYPOINT with `exec` so the variable expands while mcp-server-time still replaces the shell as PID 1 (signals like SIGTERM still reach it directly, matching the exec-form behavior everywhere else in this Dockerfile). --- src/time/Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/time/Dockerfile b/src/time/Dockerfile index ac5f752ee5..873ea2ad76 100644 --- a/src/time/Dockerfile +++ b/src/time/Dockerfile @@ -35,5 +35,10 @@ ENV PATH="/app/.venv/bin:$PATH" # Set the LOCAL_TIMEZONE environment variable ENV LOCAL_TIMEZONE=${LOCAL_TIMEZONE:-"UTC"} +# Exec-form ENTRYPOINT does not invoke a shell, so "${LOCAL_TIMEZONE}" below was +# never expanded — it was passed to the process as the literal string +# "${LOCAL_TIMEZONE}", which ZoneInfo() then rejected on every run. +# Shell form expands the variable; `exec` still replaces the shell so signals +# (e.g. SIGTERM) reach mcp-server-time directly, same as exec form would. # when running the container, add --local-timezone and a bind mount to the host's db file -ENTRYPOINT ["mcp-server-time", "--local-timezone", "${LOCAL_TIMEZONE}"] +ENTRYPOINT exec mcp-server-time --local-timezone "$LOCAL_TIMEZONE"