fix: remove hardcoded Asia/Shanghai timezone from container images#6126
Conversation
Container images should not force a region-specific timezone. Hardcoding Asia/Shanghai makes all logs and timestamps default to CST regardless of where the cluster runs, which is surprising for operators outside China and diverges from the container convention of UTC. Drop the localtime/timezone binding from all Dockerfiles so images default to UTC. The tzdata package is still installed, so operators can set their own timezone via the TZ environment variable when needed. Signed-off-by: cheyang <cheyang.cy@alibaba-inc.com>
There was a problem hiding this comment.
Code Review
This pull request removes the hardcoded timezone configuration (setting the timezone to 'Asia/Shanghai') from multiple Dockerfiles, including those for various runtimes, CSI, CRDs, and webhooks. This allows the container images to use the default system timezone or be configured dynamically. There are no review comments, and I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
Removes the hardcoded Asia/Shanghai timezone configuration from all container image Dockerfiles so the images follow the common convention of defaulting to UTC, while still installing tzdata for optional TZ overrides at runtime.
Changes:
- Removed
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtimeandecho "Asia/Shanghai" > /etc/timezonefrom all image Dockerfiles. - Kept
tzdatainstallation so operators can setTZvia container/pod environment. - Simplified each affected
RUN apk add ...block to only clear the apk cache after install.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docker/Dockerfile.alluxioruntime | Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC. |
| docker/Dockerfile.application | Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC. |
| docker/Dockerfile.cacheruntime | Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC. |
| docker/Dockerfile.crds | Removes hardcoded Asia/Shanghai timezone setup so job defaults to UTC. |
| docker/Dockerfile.csi | Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC. |
| docker/Dockerfile.dataset | Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC. |
| docker/Dockerfile.efcruntime | Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC. |
| docker/Dockerfile.jindoruntime | Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC. |
| docker/Dockerfile.juicefsruntime | Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC. |
| docker/Dockerfile.thinruntime | Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC. |
| docker/Dockerfile.vineyardruntime | Removes hardcoded Asia/Shanghai timezone setup so runtime defaults to UTC. |
| docker/Dockerfile.webhook | Removes hardcoded Asia/Shanghai timezone setup so webhook image defaults to UTC. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| RUN apk add --update bash curl iproute2 libc6-compat tzdata vim && \ | ||
| rm -rf /var/cache/apk/* && \ | ||
| cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ | ||
| echo "Asia/Shanghai" > /etc/timezone | ||
| rm -rf /var/cache/apk/* |
There was a problem hiding this comment.
Thanks — on the flagged line (RUN apk add ... && \), the two spaces sit between && and \, and the backslash is still the last character on the line, so the continuation is valid (these images have always built fine).
That said, the check pointed me at a real latent issue a few lines down: chmod -R u+w /etc/k8s-webhook-server/certs && \ had a trailing space after the backslash, which escapes the space instead of the newline. Fixed that in 1b55b1e.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6126 +/- ##
=======================================
Coverage 65.08% 65.08%
=======================================
Files 485 485
Lines 33989 33989
=======================================
Hits 22122 22122
Misses 10126 10126
Partials 1741 1741 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
….webhook The backslash on the chmod line had a trailing space, so it escaped the space instead of the newline. Strip it so the line continuation is unambiguous. Signed-off-by: cheyang <cheyang.cy@alibaba-inc.com>
|
|
/copilot review |
|
@gemini-code-assist /review |
There was a problem hiding this comment.
Code Review
This pull request removes the timezone configuration that set the local time to 'Asia/Shanghai' across multiple Dockerfiles, including various runtime, application, CSI, CRD, and webhook Dockerfiles. It also cleans up a trailing whitespace in Dockerfile.webhook. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RongGu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |



What this PR does
Container images currently force the
Asia/Shanghaitimezone in every Dockerfile:cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ echo "Asia/Shanghai" > /etc/timezoneThis makes all container logs and timestamps default to CST (UTC+8) regardless of where the cluster actually runs, which is surprising for operators outside China and diverges from the container convention of defaulting to UTC.
This PR removes the hardcoded timezone binding from all 12 Dockerfiles so images default to UTC. The
tzdatapackage remains installed, so operators who want a specific timezone can still set it via theTZenvironment variable (e.g.TZ=Asia/Shanghai) on the container/pod.Files changed
All
docker/Dockerfile.*images:Downstream behavior impact
This is a behavior change for anyone who currently relies on the implicit CST timezone baked into the images. After this PR, the container-local time shifts from CST (UTC+8) to UTC unless
TZis set. Concretely:klogdefaults to UTC) are unaffected; only components that read/etc/localtimeshift by 8 hours.dateoutput, shell scripts, and anytzdata-consuming tool inside the containers (e.g. the crd-upgrade script, entrypoint/mount scripts in the CSI image) now report UTC.metav1.Timeand event timestamps are already UTC and are unchanged. CronDataload / cache scheduling semantics are unaffected, since those are evaluated by the Kubernetes control plane, not by the container's local clock.Migration for users who need CST
No image rebuild required — set
TZon the pod/container:For Helm-deployed components this can be added via the chart's env/extraEnv values (or a pod mutation), so existing CST behavior is fully recoverable without code changes.
How to set a timezone now (optional)
Test
No functional code change; only removes region-specific timezone configuration from image build.
tzdatais still present soTZoverrides continue to work.