A lot of selfhosted containers instructions contain volume mounts like:

docker run ...
  -v /etc/timezone:/etc/timezone:ro \
  -v /etc/localtime:/etc/localtime:ro \
  ...

but all the times I tried to skip those mounts everything seemed to work perfectly.

Are those mounts only necessary in specific cases?

PS:

Bonus question: other containers instructions say to define the TZ variable. Is that only needed when one wants a container to use a different timezone than the host?

  • Coelacanthus@lemmy.kde.social
    link
    fedilink
    English
    arrow-up
    3
    ·
    8 days ago

    Without it, the program just fallback to UTC. /etc/localtime and $TZ are two ways to specify timezone for programs. The program look up the later first, if it’s empty and then use /etc/localtime. In theory, $TZ has better performance because of the glibc will not look up the last modified time of /etc/localtime when every calling of localtime lookup.