Skip to content

Alpine Docker images no longer have tzdata package in 3.0 #1366

Closed

Description

@mthalman

Alpine Docker images no longer have tzdata package in 3.0

Beginning with the 3.0 release, the tzdata package has been removed from all Alpine Docker images.

Details

This package was removed because it wasn't required for the main set of scenarios and to have consistency between the runtime-deps images across all Linux distros. This package is still installed in the 2.x images for Alpine so this will be something to be aware of when migrating from 2.x to 3.0.

You may be impacted by this if you use any of the Alpine images for 3.0 and your code has a dependency on the tzdata package, such as using the System.TimeZoneInfo API. In that case, you'll need to update your Dockerfile to explicitly install the package:

RUN apk add --no-cache tzdata

Activity

  1. seroche commented on Oct 4, 2019

    @seroche

    We deployed our first .net core microservice to our UAT environment 3 days ago. It took me few hours to find out that tzdata was missing from the docker package! @mj1856 you should probably document this. Anyone using TZConvert within an Alpine docker will have to include this package.

  2. mattjohnsonpint commented on Oct 19, 2019

    @mattjohnsonpint

    @seroche - Added here. Thanks.

  3. tushi0407 commented on Mar 20, 2020

    @tushi0407

    Hello Sorry for commenting on closed post.
    But actually i am facing the same issue here. I am using ubuntu based dot net core image 3.0 .
    My aim is very simple, i just need to find out current CST time.
    I have installed the tzdata package but still getting ResponseMessage: "System.TimeZoneNotFoundException: Exception of
    type 'System.TimeZoneNotFoundException' was thrown.↵ at TimeZoneConverter.TZConvert.GetTimeZoneInfo(String windowsOrIanaTimeZoneId)↵

    Here is my docker file :
    `FROM mcr.microsoft.com/dotnet/core/sdk:3.0-bionic AS build-env

    WORKDIR /app
    ADD UbuntuScript.sh /UbuntuScript.sh
    RUN /UbuntuScript.sh

    Copy everything else and build

    COPY . ./
    RUN dotnet publish xyz -c Release -o out

    Build runtime image

    FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-bionic
    WORKDIR /app

    #COPY --from=build-env /app/out .
    COPY --from=build-env /app/out .
    ENTRYPOINT ["dotnet", "xyz.dll"]`

    Ubuntu Script file :

    set noninteractive installation

    export DEBIAN_FRONTEND=noninteractive
    #install tzdata package
    apt-get update
    apt-get install tzdata -y

    set your timezone

    ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
    dpkg-reconfigure --frontend noninteractive tzdata

    dot net core code where i am using
    TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneConverter.TZConvert.GetTimeZoneInfo("Central Standard Time"));
    @mj1856 @mthalman please help, i m sure i am missing some small thing.

  4. mthalman commented on Mar 20, 2020

    @mthalman
    MemberAuthor

    @tushi0407 - Have you verified tzdata is installed in the image where your app is contained? From what you pasted, it looks like you're installing the package into your SDK image rather than your runtime image.

  5. tushi0407 commented on Mar 20, 2020

    @tushi0407

    Thanks for your reply @mthalman , Actually I am very new to docker. So could you please help me how I can check that? What needs to be change on docker file?

  6. tushi0407 commented on Mar 21, 2020

    @tushi0407

    Thanks @mthalman ..it is resolved now.I was doing the same mistake . I have changed the place where i was installing tzdata.Now i am installing it under run time image.I have placed ADD UbuntuScript.sh /UbuntuScript.sh RUN /UbuntuScript.sh just after FROM ../dotnet/core/aspnet:3.1-bionic WORKDIR /app. It is working now.

  7. added a commit that references this issue on May 9, 2021
  8. locked and limited conversation to collaborators on Apr 13, 2022
  9. converted this issue into a discussion #3658 on Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions