Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using the alpine:latest base image in Docker with .NET Core 8.0, the DateTime format may not work correctly. #55834

Closed
1 task done
stuyun opened this issue May 22, 2024 · 4 comments
Labels
Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically

Comments

@stuyun
Copy link

stuyun commented May 22, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

image

image

not format

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

dotnet 8.0

Anything else?

alpine:latest base image in Docker with .NET Core 8
datatime format yyyy-MM-dd HH:mm:ss -> 2024-05-22 14 Minute: 54 Minute: 00

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label May 22, 2024
@martincostello
Copy link
Member

Can you clarify exactly what you expect to see and what you actually get from the container with text, rather than screenshots. It isn't clear to me what's the expected and observed behaviours.

My guess at the cause of your issue is that the Alpine image doesn't have ICU/tzdb installed on it, so the libraries .NET depends on to do the formatting you expect are not present.

The following Alpine image should contain these additional dependencies after a basic alpine image that includes these dependencies:

mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine-extra

@martincostello
Copy link
Member

If that isn't the case, this issue doesn't appear to be specific to ASP.NET Core and should be transferred to either dotnet/runtime or dotnet/dotnet-docker.

@martincostello martincostello added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label May 22, 2024
@stuyun
Copy link
Author

stuyun commented May 22, 2024

The problem still persists even after following the provided instructions to install ICU and tzdb in the Alpine-based Docker image.

add ----------------
RUN apk add --no-cache icu-dev tzdata
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8

@dotnet-policy-service dotnet-policy-service bot added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels May 22, 2024
@stuyun stuyun closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically
Projects
None yet
Development

No branches or pull requests

2 participants