dotnet / dotnet-docker

Docker images for .NET and the .NET Tools.
https://hub.docker.com/_/microsoft-dotnet
MIT License
4.44k stars 1.93k forks source link

microsoft/dotnet:2.1-aspnetcore-runtime has the wrong system date and time for windows containers. Should pick from host. #894

Closed gauravagarwal28 closed 5 years ago

gauravagarwal28 commented 5 years ago

Steps to reproduce the issue

  1. My dockerfile is as follows:
    FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
    EXPOSE 5000
    EXPOSE 5001
    WORKDIR /app
    FROM microsoft/dotnet:2.1-sdk AS build
    WORKDIR /src
    COPY . .
    RUN dotnet restore "Alerts.API/Alerts.API.csproj"
    WORKDIR "/src/Alerts.API"
    RUN dotnet build "Alerts.API.csproj" -c Release -o /app
    FROM build AS publish
    RUN dotnet publish "Alerts.API.csproj" -c Release -o /app
    FROM base AS final
    WORKDIR /app
    COPY --from=publish /app .
    ENTRYPOINT ["dotnet", "Alerts.API.dll"]
  2. When I log in to the container, I see this:

You can see that the container's date time is far behind my system datetime+5:30UTC

image

  1. This is causing all api calls to the containerize application to fail due to the token expiry error.

Expected behavior

The container date time should be same as that of the host.

Actual behavior

The container date time is vastly different.

Output of docker version

PS C:\WINDOWS\system32> docker version
Client: Docker Engine - Community
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:47:51 2018
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.24)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:56:41 2018
  OS/Arch:          windows/amd64
  Experimental:     false

Output of docker info

PS C:\WINDOWS\system32> docker info
Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 18.09.0
Storage Driver: windowsfilter
 Windows:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: ics l2bridge l2tunnel nat null overlay transparent
 Log: awslogs etwlogs fluentd gelf json-file local logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 17134 (17134.1.amd64fre.rs4_release.180410-1804)
Operating System: Windows 10 Pro Version 1803 (OS Build 17134.523)
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 7.889GiB
Name: GauravA-PC
ID: H5EN:PYQL:W2G6:H3PB:66H4:IXGE:5HKQ:QNLR:A2ZE:V6KT:OAJ5:VX45
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: -1
 Goroutines: 39
 System Time: 2019-01-14T18:28:24.6381038+05:30
 EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

PS C:\WINDOWS\system32>
MichaelSimons commented 5 years ago

This looks to be a duplicate of https://github.com/moby/moby/issues/37283.

MichaelSimons commented 5 years ago

This is an known issue specific to the Windows base OS images. Closing.