Skip to content

feat(docker): use host system timezone instead of hardcoded Europe/Dublin#129

Open
taraxacum45e9a wants to merge 1 commit into
Xilinx:devfrom
taraxacum45e9a:pr-tz
Open

feat(docker): use host system timezone instead of hardcoded Europe/Dublin#129
taraxacum45e9a wants to merge 1 commit into
Xilinx:devfrom
taraxacum45e9a:pr-tz

Conversation

@taraxacum45e9a

Copy link
Copy Markdown

All Dockerfiles had TZ hardcoded as ENV TZ="Europe/Dublin", which baked the timezone permanently into the image and made it non-overridable at build time.

This changes TZ to a build ARG (defaulting to Europe/Dublin for backwards compatibility) and passes the host's timezone via --build-arg TZ=$(cat /etc/timezone) in run-with-docker.sh, so containers reflect the system timezone of whoever is building them.

@taraxacum45e9a taraxacum45e9a changed the title fix(docker): use host system timezone instead of hardcoded Europe/Dublin feat(docker): use host system timezone instead of hardcoded Europe/Dublin Jun 16, 2026
@amd-vserbu

Copy link
Copy Markdown
Collaborator

Agree with the change, but there are two issues:

  1. /etc/timezone is a Debian-ism, so the package script would now fail when run from RHEL. Better would be: --build-arg TZ="$(timedatectl show -p Timezone --value)" which should work on anything systemd.
  2. ARG only inserts the variable in the build environment, but not in the final runtime environment. This is a quick fix with:
ARG TZ="Europe/Dublin"
ENV TZ="${TZ}"

@quetric

quetric commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

@taraxacum45e9a thanks for your contribution. Please see Vlad's requests and update the PR to progress.

@quetric quetric requested a review from amd-vserbu June 18, 2026 11:09
@quetric quetric self-assigned this Jun 18, 2026
@taraxacum45e9a taraxacum45e9a force-pushed the pr-tz branch 2 times, most recently from 1c12a1c to d79cbdd Compare June 18, 2026 11:34
@taraxacum45e9a

taraxacum45e9a commented Jun 18, 2026

Copy link
Copy Markdown
Author

Thanks for the suggestion. I don’t have RHEL locally, so I wasn’t able to validate on that OS, but I’ve updated the script accordingly.

Regarding the ENV TZ point — since the timezone is already applied during build (via linking /etc/localtime and writing /etc/timezone), the runtime environment should already reflect the correct timezone. Given that, setting ENV TZ again seems redundant.

Co-authored-by: Vlad-Gabriel Serbu <Vlad-Gabriel.Serbu@amd.com>
Signed-off-by: Shen Jiamin <shen_jiamin@comp.nus.edu.sg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants