Wrong Timezone, Showing in UTC
This isn't specific to this container, it's also happening with lscr.io/linuxserver/firefox, but I can't seem to find out how to fix it. Currently, privacy.resistFingerprinting is set to false. I am using the container to access the HomeAssistant UI and the clock, as well as calendar appointments, are showing the wrong time. It took me a moment to figure out that it's not just the wrong time, but it's actually 6 hours ahead, which would indicate that it's probably showing UTC instead of Central Standard Time like it shows when I use the HomeAssistant app or access from a normal browser.
I'm not completely brand new to Docker but I've run out of ideas at this point. I tried adding the following:
- "/etc/timezone:/etc/timezone:ro"
But that didn't do anything. I set a new Config volume to start fresh, but that didn't do anything.
What's most annoying is that this worked perfectly the first time I set it up, and remained working with the right time for over a week. It got disconnected the other day and when it came back up, the time issue was there.
Here are the container logs in case someone sees anything useful in there. https://pastebin.com/n91gLcy4
Did you try to set the TZ environment variable ? Normally this is the only thing needed.
https://github.com/jlesage/docker-firefox#environment-variables
Yeah, I did have that set but the issue still started even with that. That's why I tried the timezone volume mapping. For now, I've just been using this image: https://github.com/siomiz/chrome but it's really weird because the time is correct in that container BUT the calendar appointment times are still in UTC.
I have "fixed" it for now by just setting that particular HomeAssistant card use a custom timezone and setting it to UTC-6 so it shows properly. Overriding each component isn't ideal but I don't have a ton of timestamps across my setup so it's not the end of the world for me.
Do you know if HomeAssistant is showing its own time or the time from the browser ?
To check if the container time is correct, you can run the following command:
docker exec <container name> date
Do you know if HomeAssistant is showing its own time or the time from the browser ?
To check if the container time is correct, you can run the following command:
docker exec <container name> date
I know this is old, but I'm seeing home assistant graphs that use UTC when showing history. The Home Assistant app on my Mac shows the graphs in the local timezone. Executing the above docker command yields the local time. I also found that if I changed the user preference for the time format from "Auto" to "Use system locale" it fixed the problem. Commenting because I found this thread while trying to figure what to do and figured I'd post my solution
Thanks for your feedback!
Whenever I set environment variable TZ different from UTC it does not work.
I get date in UTC using docker exec firefox date.
My docker-compose.yml:
version: '3' services: firefox: image: jlesage/firefox container_name: firefox ports: - "5800:5800" - "5900:5900" volumes: - "${PWD}/config:/config:rw" environment: - LANG="ru_RU.UTF-8" - TZ="Europe/Moscow" restart: unless-stopped
The LANG also not set. What could be a problem?
P.S
May be it is platform specific? Mine is aarch64 GNU/Linux
Did you check the output of docker inspect firefox to make sure the variables were set as expected?
For me the timezone works fine"
~# docker run --rm jlesage/firefox date
Tue Feb 20 23:31:50 UTC 2024
:~# docker run --rm -e TZ=Europe/Moscow jlesage/firefox date
Wed Feb 21 02:32:04 MSK 2024
Thank you for reply.
I have checked variables with docker inspect firefox: "LANG=\"ru_RU.UTF-8\""
So the problem was I declared TZ using docker-compose in double quotes - TZ="Europe/Moscow".
I deleted the quotes and now the date is correct.
Great! So now everything works as expected ?
Yes, except language. I removed quotes in LANG variable as well and container initiated it correctly, but my AppDaemon date widget shows "Wed, 21/02" in it while in normal browser it is "Ср, 21/02", in russian.
See https://github.com/jlesage/docker-firefox/issues/109#issuecomment-1369095002. Does this help ?