System.TimeZoneNotFoundException: The time zone ID 'Asia/Kolkata' was not found on the
local computer. on mcr.microsoft.com/dotnet/runtime:10.0-alpine means the
image has no time zone database. Add RUN apk add --no-cache tzdata to the
Dockerfile and use the IANA id, such as Asia/Kolkata.
With tzdata installed, Asia/Kolkata worked. The same call without tzdata
failed because the image had no /usr/share/zoneinfo folder at all.
The error
PS> docker run --rm --name fix10-dn-tz1 fix10-dn-lab-alpine tz Asia/Kolkata
Unhandled exception. System.TimeZoneNotFoundException: The time zone ID 'Asia/Kolkata' was not found on the local computer.
---> System.IO.DirectoryNotFoundException: Could not find a part of the path '/usr/share/zoneinfo/Asia/Kolkata'.
...
at System.TimeZoneInfo.FindSystemTimeZoneById(String id)
at Program.<Main>$(String[] args) in /src/Program.cs:line 5
Why it happens
The inner exception names the file the runtime tried to read:
/usr/share/zoneinfo/Asia/Kolkata. On the Alpine runtime image that folder
does not exist at all:
PS> docker run --rm --name fix10-dn-tz6 --entrypoint ls fix10-dn-lab-alpine /usr/share/zoneinfo
ls: /usr/share/zoneinfo: No such file or directory
Each failing run exited with code 139, and the trace points at line 5 of
Program.cs, the FindSystemTimeZoneById call: the app started
normally and crashed at its first time zone lookup, not at start-up.
The same build on mcr.microsoft.com/dotnet/runtime:10.0 found the zone and
printed Asia/Kolkata: 2026-11-13 11:30, so the code was fine; the Alpine image
was missing the data.
The inner exception type is worth a look too. Without tzdata,
Asia/Kolkata gave DirectoryNotFoundException for
/usr/share/zoneinfo/Asia/Kolkata, on an image with no zoneinfo folder. With
tzdata installed, 'India' gave FileNotFoundException for
/usr/share/zoneinfo/India (shown below).
The fix
...
FROM mcr.microsoft.com/dotnet/runtime:10.0-alpine
RUN apk add --no-cache tzdata
WORKDIR /app
COPY --from=build /out .
ENTRYPOINT ["dotnet", "ClinicApi.dll"]
PS> docker run --rm --name fix10-dn-tz3 fix10-dn-lab-tz tz Asia/Kolkata
Asia/Kolkata: 2026-11-13 11:30
Use the IANA name. An attempt with the Windows name on the same fixed image failed (the
doubled quotes are how the test runner passed the argument through cmd /c):
PS> docker run --rm --name fix10-dn-tz4 fix10-dn-lab-tz tz ""India Standard Time""
Unhandled exception. System.TimeZoneNotFoundException: The time zone ID 'India' was not found on the local computer.
---> System.IO.FileNotFoundException: Could not find file '/usr/share/zoneinfo/India'.
...
Note the id in that message is 'India', not the full Windows name. In this
test the quotes did not survive the runner, so only the first word reached
FindSystemTimeZoneById; the full Windows name as one argument was not
tested here. Asia/Kolkata is the id that worked, so that is what to put in
configuration a Linux container reads.
How it was reproduced
A console app on mcr.microsoft.com/dotnet/sdk:10.0 (SDK 10.0.302) whose
tz mode calls TimeZoneInfo.FindSystemTimeZoneById(args[1]) and
converts 06:00 UTC on Nov 13, 2026; the working runs printed 11:30, five and a half hours
ahead, which is India's offset. It ran on
mcr.microsoft.com/dotnet/runtime:10.0-alpine (Alpine 3.24.4,
Microsoft.NETCore.App 10.0.15) and, for comparison, on
mcr.microsoft.com/dotnet/runtime:10.0 (10.0.13). Docker engine 29.9.3 on
Windows 11.
Frequently asked
- How do I add time zones to a .NET Alpine Docker image?
- Add RUN apk add --no-cache tzdata to the final stage. In the test /usr/share/zoneinfo did not exist on runtime:10.0-alpine until that package was installed.
- Does Asia/Kolkata work in a .NET container?
- Yes, once the image has tzdata. It worked on runtime:10.0 out of the box and on runtime:10.0-alpine after apk add tzdata.
- Why does the error say time zone ID 'India' when I passed India Standard Time?
- In the test the quotes were lost on the command line, so only the first word reached the call. Check how your configuration or command line passes the id, and use the IANA name Asia/Kolkata, which worked.
The same Alpine image also lacks culture data: Only the invariant culture is supported. More decoded errors in the Fixes category.