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?

  • DaGeek247@fedia.io
    link
    fedilink
    arrow-up
    3
    ·
    6 days ago

    It’s so the container has the correct local time. It doesn’t matter unless you’re trying to schedule things in the container and don’t want to calculate the offset every time you do.