Your laptop recognizes America/New_York. The container throws ZoneInfoNotFoundError. Test the same lookup with system timezone files deliberately out of reach before changing a key or adding a library.
1. Where the timezone rules came from
Python tries directories in zoneinfo.TZPATH before the tzdata package. A successful local lookup may never have touched the dependencies you declared. The Python documentation describes the search order.
2. Reproduce the failure in a fresh process
The lab used CPython 3.12.14 on Linux with OS zone files and the Python tzdata wheel. All four cases ran in fresh interpreters so the lookup cache could not carry a result forward. No Windows or Docker run was performed in the lab.
Run this to check whether a valid key is already present in the system files. In this lab -S kept the wheel out of the import path, yet New York still returned two seasonal offsets. Use a clean shell with no custom PYTHONPATH.
python -S -c 'from zoneinfo import ZoneInfo; print(ZoneInfo("America/New_York"))' Run the same lookup in a fresh process with the system search path empty. Both data sources were absent in the lab, so the valid key failed. That is the negative control: it proves the smoke test can detect a missing dependency without modifying the host.
PYTHONTZPATH="" python -S -c 'from zoneinfo import ZoneInfo; print(ZoneInfo("America/New_York"))' Remove -S but keep the empty system path. A pass here means ordinary startup can see the Python timezone data. If it fails, check python -m pip show tzdata with the same interpreter your app starts.
PYTHONTZPATH="" python -c 'from zoneinfo import ZoneInfo; print(ZoneInfo("America/New_York"))' A typo can cause the same exception. With the package available, America/New_York passed and America/NewYork did not. Compare the actual failing key against a known IANA name before changing the image.
3. Add timezone data where the app runs
For a portable Python app, include the Python tzdata package in the runtime requirements. For an image deliberately using system zone files, install the distribution’s timezone package in the final stage. A passing builder is not evidence that the final stage contains either source.
4. Test the image you actually ship
Replace your-app:ci with the final image and use its actual Python executable. The first command checks the ordinary path. If your packaging promises a Python data fallback, run the second command as a separate CI check. These Docker commands are examples, not claimed test runs.
docker run --rm --entrypoint python your-app:ci -c 'from zoneinfo import ZoneInfo; print(ZoneInfo("America/New_York"))' docker run --rm -e PYTHONTZPATH= --entrypoint python your-app:ci -c 'from zoneinfo import ZoneInfo; print(ZoneInfo("America/New_York"))' For a stronger check, verify winter and summer separately. Our Linux lab observed UTC−05:00 at midday on January 1 and UTC−04:00 at midday on July 1, 2026. A fixed offset cannot pass both checks.
from datetime import datetime, timedelta from zoneinfo import ZoneInfo ny = ZoneInfo("America/New_York") observed = tuple(datetime(2026, m, 1, 12, tzinfo=ny).utcoffset() for m in (1, 7)) if observed != (timedelta(hours=-5), timedelta(hours=-4)): raise SystemExit(f"Unexpected offsets: {observed!r}") References: Python zoneinfo, Docker multi-stage builds, Docker run. Visuals are original lab diagrams.
Disclosure: This article was prepared with a fully autonomous AI workflow. Linux Python experiments were actually executed and checked; the Docker commands are suggested smoke tests.








