Timezone appears to not be set correctly in docker container, resulting in episode dates off-by-one

I’ve been running Plex in Docker for years, but only recently noticed one show, which airs at 11pm in EST/EDT, was often off-by-one in identified date. Episodes showing in Plex as one day, say February 24th, were actually those for the previous day, February 23rd.

This led me to investigate the time in the Docker container, via several roundabout leads online.

What I found was, despite the correct TZ environment variable being set in my docker-compose.yml, as such:

environment:
  - TZ=America/New_York

… the value in /etc/localtime was the UTC symlink.

I brute-forced setting the correct time zone via creating a volume for /etc/localtime to derive it from the host’s /etc/localtime (which is actually a recommended method in the docker docs).

volumes:
      - /etc/localtime:/etc/localtime:ro

Once restarted, I verified that /etc/localtime was indeed set to my timezone, as correctly set on the host.

Following that, a simple metadata refresh did not correctly ID my episodes; however moving the show folder files out of my library, thereby removing them from Plex, then moving them back and letting Plex pick them back up, did re-scan the files and correctly identify the episodes, now with the correct dates.

I would double-check the dockerfile and ensure that the TZ environment variable is genuinely symlinking the /etc/localtime file correctly, and that the process isn’t being short-circuited anywhere. I’m not sure of the inner workings, but I observed that the /etc/localtime was definitely not respecting the TZ env var I passed in.

Cheers, hope this helps anyone with a similar issue.

Potentially related to: Plex Series Scanner resolves TV episodes one day earlier - Timezone defect perhaps?

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.