While I gather your specific setup details, here are some general considerations for time synchronization between Docker containers and the host on Torizon:
Container Time Isolation:
By default, Docker containers share the host’s kernel but may have isolated views of certain system resources. Time synchronization issues can occur when:
The container doesn’t have access to /etc/localtime or /etc/timezone
System time settings aren’t properly mounted or shared
Common Solutions:
Mount timezone information by adding volume mounts when running your container:
How exactly are you running your container in this case?
I just did a test and it seems to work fine with the following:
$ docker run -it -d --rm --name coj -v /etc/localtime:/etc/localtime:ro debian /bin/bash
# On host
$ date
Fri Jul 10 10:57:52 AM PDT 2026
$ docker exec -it coj /bin/bash
# In container
$ date
Fri Jul 10 10:57:59 PDT 2026
As you can see I just had to bind-mount /etc/localtime from the host into the container. Once I did that the time output of date in the container matches the host.
The problem arises when I use NTP to set date and time in the host by running “timedatectl -set-ntp true” and “timedatectl -set-timezone timezone”. Then, the date and time are updated in the host, but not in the container, maybe because the container continues attached to the UTC time? See this output:
torizon@colibri-imx8x-06996015:~$ date
Mon Jul 13 06:40:49 BST 2026
torizon@colibri-imx8x-06996015:~$ docker exec torizon-debug-1 date
Mon Jul 13 07:40:59 CEST 2026
torizon@colibri-imx8x-06996015:~$ file /etc/localtime
/etc/localtime: symbolic link to ../usr/share/zoneinfo/Europe/London
torizon@colibri-imx8x-06996015:~$ docker exec torizon-debug-1 file /etc/localtime
/etc/localtime: symbolic link to /usr/share/zoneinfo/Etc/UTC
I see. The issue here is that when you bind-mount /etc/localtime directly into the container it follows the symlink at the time of container creation. Which leads to /etc/localtime in the container not being a symlink like it is on the host. This means if the symlink on the host were to change, which is what timedatectl set-timezone timezone does, then this doesn’t update /etc/localtime in the container.
What you can do is instead bind-mount the parent directory /etc in this case. If you do that then changes under /etc on the host (like symlink changes), should be reflected in the container.
I did a quick test and it seems to work:
torizon@verdin-imx8mp-06849059:~$ docker run -it -d --rm --name coj -v /etc/:/etc/:ro debian /bin/bash
torizon@verdin-imx8mp-06849059:~$ date
Mon Jul 13 16:52:48 UTC 2026
torizon@verdin-imx8mp-06849059:~$ docker exec -it coj date
Mon Jul 13 16:52:51 UTC 2026
torizon@verdin-imx8mp-06849059:~$ sudo timedatectl set-timezone America/Los_Angeles
torizon@verdin-imx8mp-06849059:~$ date
Mon Jul 13 09:53:10 PDT 2026
torizon@verdin-imx8mp-06849059:~$ docker exec -it coj date
Mon Jul 13 09:53:13 PDT 2026
As you can see, by bind-mounting all of /etc, changing timezone on the host gets reflected properly into the container as well.
I assume this is in the debug version of your container?
In the debug container some data gets written to /etc so that VSCode can connect via SSH during the debug process. But if you bind-mount the host /etc this would overwrite the original /etc in the container. Which is why you’re seeing an issue with the SSH process failing in VSCode.
Not sure there’s an elegant way around this in the debug container that doesn’t break the debug functionality. In the release version of the container this wouldn’t be a problem I imagine since there’s no debug process of course.
This might be something you can only realistically test in the release version of the container.
Yes, I tried in the debug container. I will try the release version when I have time.
In the meantime, I found out that calling setenv(“TZ”, TimeZoneID, 1) is a feasible workaround to get timezone updated in my app (not in the container).