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

DateTime format issue with Alpine 3.19 #5234

Closed
AndreasBreuninger opened this issue Feb 29, 2024 · 12 comments
Closed

DateTime format issue with Alpine 3.19 #5234

AndreasBreuninger opened this issue Feb 29, 2024 · 12 comments

Comments

@AndreasBreuninger
Copy link

Describe the Bug

Analogous to the example of the globalization of the Alpine image as described here

alpine-globalization
Dockerfile.alpine-icu

we notice a strange behavior with Alpine 3.19 when formatting a DateTime object. The dotnet version does not matter. It can be reproduced with .net 7 as well as .net 8.

When using alpine 3.18 a DateTime.Now.ToString() results in 2024-02-29 12:47:57
Using 3.19 the same code produces 2024-02-29 12 Minute Minute: 50

Steps to Reproduce

Working sample DateTimeAlpine318.zip
Broken sampleDateTimeAlpine319.zip

Other Information

  • We set the CultureInfo de_DE.UTF-8
  • With the Update of alpine 3.18 to 3.19 the icu-libs changed from 73.2 to 74.1

Output of docker version

`
Client:
Cloud integration: v1.0.35+desktop.10
Version: 25.0.2
API version: 1.44
Go version: go1.21.6
Git commit: 29cf629
Built: Thu Feb 1 00:24:09 2024
OS/Arch: windows/amd64
Context: default

Server: Docker Desktop 4.27.1 (136059)
Engine:
Version: 25.0.2
API version: 1.44 (minimum version 1.24)
Go version: go1.21.6
Git commit: fce6e0c
Built: Thu Feb 1 00:23:17 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.28
GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0`

Output of docker info

`
Client:
Version: 25.0.2
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.12.1-desktop.4
Path: C:\Program Files\Docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.24.3-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-compose.exe
debug: Get a shell into any image or container. (Docker Inc.)
Version: 0.0.22
Path: C:\Program Files\Docker\cli-plugins\docker-debug.exe
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.0
Path: C:\Program Files\Docker\cli-plugins\docker-dev.exe
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.21
Path: C:\Program Files\Docker\cli-plugins\docker-extension.exe
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.4
Path: C:\Program Files\Docker\cli-plugins\docker-feedback.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.0.0
Path: C:\Program Files\Docker\cli-plugins\docker-init.exe
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: C:\Program Files\Docker\cli-plugins\docker-sbom.exe
scout: Docker Scout (Docker Inc.)
Version: v1.3.0
Path: C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
Containers: 6
Running: 5
Paused: 0
Stopped: 1
Images: 16
Server Version: 25.0.2
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
Kernel Version: 5.15.133.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.864GiB
Name: docker-desktop
ID: a81734e0-d357-42b6-95f1-4a52058ea948
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile
`

@lbussell
Copy link
Contributor

[Triage] This seems like an unintentional behavior change in runtime based on the new libicu version. I'll transfer the issue there.

@lbussell lbussell transferred this issue from dotnet/dotnet-docker Feb 29, 2024
@ghost
Copy link

ghost commented Feb 29, 2024

Tagging subscribers to this area: @dotnet/area-system-globalization
See info in area-owners.md if you want to be subscribed.

Issue Details

Describe the Bug

Analogous to the example of the globalization of the Alpine image as described here

alpine-globalization
Dockerfile.alpine-icu

we notice a strange behavior with Alpine 3.19 when formatting a DateTime object. The dotnet version does not matter. It can be reproduced with .net 7 as well as .net 8.

When using alpine 3.18 a DateTime.Now.ToString() results in 2024-02-29 12:47:57
Using 3.19 the same code produces 2024-02-29 12 Minute Minute: 50

Steps to Reproduce

Working sample DateTimeAlpine318.zip
Broken sampleDateTimeAlpine319.zip

Other Information

  • We set the CultureInfo de_DE.UTF-8
  • With the Update of alpine 3.18 to 3.19 the icu-libs changed from 73.2 to 74.1

Output of docker version

`
Client:
Cloud integration: v1.0.35+desktop.10
Version: 25.0.2
API version: 1.44
Go version: go1.21.6
Git commit: 29cf629
Built: Thu Feb 1 00:24:09 2024
OS/Arch: windows/amd64
Context: default

Server: Docker Desktop 4.27.1 (136059)
Engine:
Version: 25.0.2
API version: 1.44 (minimum version 1.24)
Go version: go1.21.6
Git commit: fce6e0c
Built: Thu Feb 1 00:23:17 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.28
GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0`

Output of docker info

`
Client:
Version: 25.0.2
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.12.1-desktop.4
Path: C:\Program Files\Docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.24.3-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-compose.exe
debug: Get a shell into any image or container. (Docker Inc.)
Version: 0.0.22
Path: C:\Program Files\Docker\cli-plugins\docker-debug.exe
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.0
Path: C:\Program Files\Docker\cli-plugins\docker-dev.exe
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.21
Path: C:\Program Files\Docker\cli-plugins\docker-extension.exe
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.4
Path: C:\Program Files\Docker\cli-plugins\docker-feedback.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.0.0
Path: C:\Program Files\Docker\cli-plugins\docker-init.exe
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: C:\Program Files\Docker\cli-plugins\docker-sbom.exe
scout: Docker Scout (Docker Inc.)
Version: v1.3.0
Path: C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
Containers: 6
Running: 5
Paused: 0
Stopped: 1
Images: 16
Server Version: 25.0.2
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
Kernel Version: 5.15.133.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.864GiB
Name: docker-desktop
ID: a81734e0-d357-42b6-95f1-4a52058ea948
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile
`

Author: AndreasBreuninger
Assignees: -
Labels:

bug, area-System.Globalization, area-Infrastructure, untriaged

Milestone: -

@MichalPetryka
Copy link

Alpine 3.19 seems to have the same ICU version as in dotnet/runtime#98941, could ICU 74.1 maybe break both CoreCLR and Mono globalization code?

@danmoseley
Copy link
Member

Does it only happen in that culture?

@AndreasBreuninger
Copy link
Author

AndreasBreuninger commented Feb 29, 2024

Does it only happen in that culture?

Didn't check this on other cultures so far. But I can do this tomorrow German time.
Faced the issue when we got strange PDF Reports after a new deployent of one of our Services.

@tarekgh
Copy link
Member

tarekgh commented Feb 29, 2024

I commented the following lines from the dockerfile to just manually run the image without exiting:

#RUN dotnet build "DateTimeAlpine319.csproj" -c $BUILD_CONFIGURATION -o /app/build

#FROM build AS publish
#ARG BUILD_CONFIGURATION=Release
#RUN dotnet publish "DateTimeAlpine319.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

#FROM base AS final
#WORKDIR /app
#COPY --from=publish /app/publish .
#ENTRYPOINT ["dotnet", "DateTimeAlpine319.dll"]

manually set the environment variables as I noticed are not set when I ran the image

LANG=de_DE.UTF-8
LC_ALL=de_DE.UTF-8

Then compiled the code and run it and I am getting:

/src/DateTimeAlpine319 # dotnet run
Linux 5.10.102.1-microsoft-standard-WSL2 dotnet/runtime#1 SMP Wed Mar 2 00:30:59 UTC 2022
.NET 7.0.16
.... /usr/lib/libicui18n.so.74.1:
.... /usr/lib/libicuuc.so.74.1:
.... ICU Version: 74.1.0.0
.... Invariant:              False ....
.... PredefinedCulturesOnly: False ....
CurrentCulture: de-DE
DateTime.Now: 29.02.2024 23:02:12

If I didn't modify the docker file and run it, I am seeing the result that @AndreasBreuninger mentioned. Looks to me is more about configuration or running the app but .NET not really have a problem using ICU 74 and getting the correct result. Anyone more familiar with docker builds can help?

@richlander

@tarekgh
Copy link
Member

tarekgh commented Feb 29, 2024

@lbussell could you please help having more look? Could you please transfer the issue back to dotnet-docker repo? I couldn't find this repo listed in our transfer list :-(

@ghost ghost removed the untriaged label Feb 29, 2024
@tarekgh
Copy link
Member

tarekgh commented Mar 1, 2024

Looks the first Base stage in docker file is missing something. If I change the line in the docker file from

- FROM base AS final
+ FROM publish AS final

It work fine. I have no idea though why this is happening.

@lbussell
Copy link
Contributor

lbussell commented Mar 1, 2024

Hi @AndreasBreuninger, I just took another look at this and was able to repro it. I noticed that you are missing the package icu-data-full in your repro Dockerfile. We have this package documented in our Alpine ICU sample Dockerfile. I'm not sure why the behavior changed between alpine versions. If you add icu-data-full to your final image layer you should get the correct behavior.

@tarekgh
Copy link
Member

tarekgh commented Mar 1, 2024

@lbussell could you please move this issue back to the dotnet-docker repo and close it if there is no more action needed after @AndreasBreuninger confirm?

@AndreasBreuninger
Copy link
Author

icu-data-full

I can confirm that it works with the addition of the icu-data-full package. Thank you for your support on this topic.

@lbussell lbussell transferred this issue from dotnet/runtime Mar 1, 2024
@lbussell
Copy link
Contributor

lbussell commented Mar 1, 2024

No problem! Closing as not planned since there is no work here.

@lbussell lbussell closed this as not planned Won't fix, can't repro, duplicate, stale Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

5 participants