Skip to content

add tzdata package#748

Open
mmichalak-swe wants to merge 1 commit intooffen:mainfrom
mmichalak-swe:Add-package-tzdata
Open

add tzdata package#748
mmichalak-swe wants to merge 1 commit intooffen:mainfrom
mmichalak-swe:Add-package-tzdata

Conversation

@mmichalak-swe
Copy link
Contributor

@mmichalak-swe mmichalak-swe commented Mar 13, 2026

Changes

  • Add tzdata package to Docker image

Reason

Installing tzdata provides the system timezone database and allows the container timezone to be configured via the TZ environment variable.

@m90
Copy link
Member

m90 commented Mar 13, 2026

I'm a bit torn on this one, mostly because of not wanting to change things that currently work as intended. I would definitely think this is something to include in a v3, yes.

One big question in here would be: considering this would be merged and users that currently mount their TZ data as it's done right now updated without changing their config, would their setups still continue to work?

@mmichalak-swe
Copy link
Contributor Author

I just tested it by using my custom image (only adding tzdata to the existing v2.47.2 image), and commenting out the bind mounts:

environment:
  - TZ=${TZ}
image: offen/docker-volume-backup:v2.47.2-tzdata-test
volumes:
  # - /etc/timezone:/etc/timezone:ro
  # - /etc/localtime:/etc/localtime:ro
  # - /usr/share/zoneinfo:/usr/share/zoneinfo:ro

I also tried the custom image with tzdata added, against my old configuration (without a TZ variable, and with the bind mounts):

environment:
#   - TZ=${TZ}
image: offen/docker-volume-backup:v2.47.2-tzdata-test
volumes:
  - /etc/timezone:/etc/timezone:ro
  - /etc/localtime:/etc/localtime:ro
  - /usr/share/zoneinfo:/usr/share/zoneinfo:ro

I then tried using the custom tzdata image, with both configurations enabled together:

environment:
  - TZ=${TZ}
image: offen/docker-volume-backup:v2.47.2-tzdata-test
volumes:
  - /etc/timezone:/etc/timezone:ro
  - /etc/localtime:/etc/localtime:ro
  - /usr/share/zoneinfo:/usr/share/zoneinfo:ro

All cases are working as expected, producing the expected time with the date command, while also creating a local backup with the correct time. Additionally, this worked while stopping and starting a container to perform the backup. I understand your hesitation, but I think this is a low-risk change with a lot of upside. To set my timezone correctly, I had to read the documentation, and then follow the guidance given in #28. That is a lot of effort for what should be a simple setting, that some users might miss!

Perhaps it is better saved for v3, but I think this functionality could be enabled without issue immediately.

@m90
Copy link
Member

m90 commented Mar 13, 2026

To set my timezone correctly, I had to read the documentation, and then follow the guidance given in #28.

What info was missing from the docs that you could find in #28 only?

@mmichalak-swe
Copy link
Contributor Author

From #28 (comment)

/usr/share/zoneinfo:/usr/share/zoneinfo:ro

Page it's missing from: set container timezone

services:
  backup:
    image: offen/docker-volume-backup:v2
    volumes:
      - data:/backup/my-app-backup:ro
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro

volumes:
  data:

I can edit and open a PR to fix

@m90
Copy link
Member

m90 commented Mar 13, 2026

I can edit and open a PR to fix

That'd be grand 🎩

@m90 m90 mentioned this pull request Mar 16, 2026
@mmichalak-swe
Copy link
Contributor Author

mmichalak-swe commented Mar 16, 2026

Continuing our conversation here...

Thanks! I guess I'll need a little more time to ponder #748, I hope that's ok.

No worries. I can do some more testing and report back. I was doing some research on ChatGPT and it agrees that it's a low-risk change. I think the testing I did above will cover users that upgrade to a new image that includes tzdata, while their configuration may still contain the bind mounts (the bind mounts would take precedence). Let me know if there's anything else I can help you with on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants