Setting TimeZone for a Windows Container
Edited: as Pierre-Luc Champigny pointed, according to Microsoft, this is now supported on ltsc versions and upcoming ones: https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/virtual-time-zone
tzutil
throws lack of privileges error- registry settings are ignored when container starts
It seems like you have to ensure the correct Time Zone on container host.That's doesn't make much sense, AFAIK, the whole thing about containers is ship it as image once and run it everywhere, with environment isolation and integrity.. right?!
Anyway you can see more detail on that issue on github.
Also, I've open this suggestion on Windows Server uservoice, to change that behavior.
Also, I've open this feature suggestion for improving Azure AKS host configuration for Time Zone.
As of May 2021 in the 2105B servicing release (WS2019 build 10.0.17763.1935) the ability to configure the time zone within a container is now supported. You can use either tzutil or Set-TimeZone to set a time zone configuration local to the container.
More info is available here: https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/virtual-time-zone
Did you try to use the tzutil
command?
Method 1:
Following an example to use the command and set an Australian time zone:
tzutil /s "AUS Eastern Standard Time"
Method 2:
The registry entry
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
has all the information relating to timezone.From a virtual or physical machine with the correct time zone, you can export the registry values and import to the container.