Skip to content

How does a container know the exact time (UTC timezone) from host machine? #45691

Answered by neersighted
baojingh asked this question in Q&A
Discussion options

You must be logged in to vote

A container is not a VM -- it's just a namespaced slice of resources on the same kernel as your 'host' machine. In this case, timezones are a construct of userspace (more or less); so timezones inside the container are defined by the container rootfs (filesystem) and not the 'host' filesystem.

In the future, we can create a time namespace for the container (https://manpages.ubuntu.com/manpages/impish/man7/time_namespaces.7.html); this namespace defaults to the same time as the root ('host') time namespace.

Note that what is namespaced is a subset of clocks (mostly, time since boot/monotonic clocks); the wall clock is not virtualized by time namespaces.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@baojingh
Comment options

@neersighted
Comment options

@raesene
Comment options

@thaJeztah
Comment options

@thaJeztah
Comment options

Answer selected by baojingh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
status/0-triage kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.
4 participants
Converted from issue

This discussion was converted from issue #45680 on June 02, 2023 13:56.