Skip to content

Commit 024c9e8

Browse files
committed
fix(time): expand LOCAL_TIMEZONE in Docker ENTRYPOINT
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). Signed-off-by: ks72 <[email protected]>
1 parent 38569bd commit 024c9e8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/time/Dockerfile‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,10 @@ ENV PATH="/app/.venv/bin:$PATH"
3838
# Set the LOCAL_TIMEZONE environment variable
3939
ENV LOCAL_TIMEZONE=${LOCAL_TIMEZONE:-"UTC"}
4040

41+
# Exec-form ENTRYPOINT does not invoke a shell, so "${LOCAL_TIMEZONE}" below was
42+
# never expanded — it was passed to the process as the literal string
43+
# "${LOCAL_TIMEZONE}", which ZoneInfo() then rejected on every run.
44+
# Shell form expands the variable; `exec` still replaces the shell so signals
45+
# (e.g. SIGTERM) reach mcp-server-time directly, same as exec form would.
4146
# when running the container, add --local-timezone and a bind mount to the host's db file
42-
ENTRYPOINT ["mcp-server-time", "--local-timezone", "${LOCAL_TIMEZONE}"]
47+
ENTRYPOINT exec mcp-server-time --local-timezone "$LOCAL_TIMEZONE"

0 commit comments

Comments
 (0)