How can I apply the time zone of an LXD host to one of its containers created from image “Ubuntu focal amd64”? The time zone of the LXD host is “America/Montreal” (-05:00 or -04:00 during Daylight Savings Time (DST)) and that of the container is UTC. Is UTC the default time zone for containers created from any Linux image from https://images.linuxcontainers.org?
Following the instructions in @simos’ very helpful blog post:
$ lxc start development1 $ lxc exec development1 -- date Tue May 19 16:55:46 UTC 2020 $ lxc profile set macvlan environment.TZ America/Montreal $ lxc exec development1 -- date Tue May 19 12:56:09 EDT 2020 $ lxc restart development1 $ lxc exec development1 -- date Tue May 19 12:56:27 EDT 2020 $ lxc exec development1 -- cat /etc/timezone Etc/UTC
- After changing environment variable
TZin the profile, LXD immdiately applies the change to the running container and this change persists after restart.
- Changing environment variable
TZdoes not affect the default time zone in
/etc/timezonewhich is still