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

Docker reports incorrect time to containers under virtualized Windows #12499

Closed
3 tasks done
TheMatt2 opened this issue Jan 17, 2022 · 7 comments
Closed
3 tasks done

Docker reports incorrect time to containers under virtualized Windows #12499

TheMatt2 opened this issue Jan 17, 2022 · 7 comments

Comments

@TheMatt2
Copy link

  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID: AD825D2B-626E-4575-A362-00C4699E7246/20220117172557

Actual behavior

The time reported to docker containers refers to a time in the past.
This leads to observable problems if you run date

Starting a new docker container returns the timestamps:

root@be8f2d2b9890:/# date
Sun Jan 16 15:34:53 UTC 2022
root@be8f2d2b9890:/# date +%s
1642347297
root@be8f2d2b9890:/#

At that time, the timestamp should have been (off by about a day)

% date
Mon Jan 17 12:20:52 EST 2022
% date +%s
1642440065

This applies to programs that check for the date as well, such as apt-get.
This leads to error messages such as:

root@be8f2d2b9890:/# apt-get update
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:6 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Reading package lists... Done
E: Release file for http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease is not valid yet (invalid for another 1d 0h 6min 20s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease is not valid yet (invalid for another 1d 1h 14min 44s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease is not valid yet (invalid for another 1d 0h 7min 39s). Updates for this repository will not be applied.

With apt-get failing due to the time issue.
(The host windows system is reporting the correct time.)

Expected behavior

The time reported inside of the docker container should match the time of the host windows system.

Information

This problem is this issue leads to incorrect timestamps and failing server connections due to time being off.
This is reliably reproducible. I am not sure when this issue first appeared.

The issue seems to be the time becomes incorrect if the Windows virtual machine is paused. When Windows is resumed, the the time reported inside the docker container does not update. The Windows machine does correctly jump to the current time.

Neither restarting Docker Desktop nor using the "Pause" in Docker Desktop corrects the time.
Enabling the "Time Sync" setting on in VMware also does not solve the issue.

The only way to correct the time in the docker container is to restart the Windows virtual machine.

  • Windows Version: Windows 11 21H2
  • Docker Desktop Version: Docker Desktop 4.3.2 (72729)
  • WSL2 or Hyper-V backend? WSL2
  • Are you running inside a virtualized Windows e.g. on a cloud server or a VM: YES. VMware Workstation 16 Pro

Output of & "C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" check

[goroutine 1 [running, locked to thread]:
[win/backend/pkg/service.NewClientForPath(...)
[       win/backend/pkg/service/service.go:26
[win/backend/pkg/service.NewClient(...)
[       win/backend/pkg/service/service.go:20
[common/pkg/diagkit/gather/diagnose.init()
[       common/pkg/diagkit/gather/diagnose/ipc_windows.go:23 +0x13b
Starting diagnostics

[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0031: does the Docker API work?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0001: is the application running?
[SKIP] DD0018: does the host support virtualization?
[PASS] DD0002: does the bootloader have virtualization enabled?
[PASS] DD0017: can a VM be started?
[PASS] DD0024: is WSL installed?
[PASS] DD0021: is the WSL 2 Windows Feature enabled?
[PASS] DD0022: is the Virtual Machine Platform Windows Feature enabled?
[PASS] DD0025: are WSL distros installed?
[PASS] DD0026: is the WSL LxssManager service running?
[PASS] DD0029: is the WSL 2 Linux filesystem corrupt?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0003: is the Docker CLI working?
[PASS] DD0013: is the $PATH ok?
[PASS] DD0005: is the user in the docker-users group?
[PASS] DD0007: is the backend responding?
[PASS] DD0014: are the backend processes running?
[PASS] DD0008: is the native API responding?
[PASS] DD0009: is the vpnkit API responding?
[PASS] DD0010: is the Docker API proxy responding?
[PASS] DD0006: is the Docker Desktop Service responding?
[PASS] DD0012: is the VM networking working?
[PASS] DD0032: do Docker networks overlap with host IPs?
[SKIP] DD0030: is the image access management authorized?
[PASS] DD0033: does the host have Internet access?
No fatal errors detected.

Steps to reproduce the behavior

  1. Create a virtual instance of Windows in VMware from https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/
  2. Install Docker Desktop
  3. Run docker run --rm ubuntu date
  4. Observe the date is correct
  5. Pause the Virtual Machine from VMware
  6. Leave the virtual machine paused for a while (a minute should be enough)
  7. Resume the virtual machine
  8. Run docker run --rm ubuntu date
  9. Observer the date is now off. The date is stale by about the duration the vm was frozen.
@gao-artur
Copy link

Same issue with WSL2

@TheMatt2
Copy link
Author

Can confirm. WSL2 container running on the machine reports the same incorrect time.

@TheMatt2
Copy link
Author

Perhaps related to microsoft/WSL#4114

@docker-robott
Copy link
Collaborator

Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

@ribtoks
Copy link

ribtoks commented May 6, 2022

This is not stale. I can reproduce it with the latest Docker Desktop (4.7.1 (77678)) on Windows 10.

@VivaLaRobo
Copy link

I am also having the same problem with 4.7.1. We use VMs with snapshots and Docker constantly gets out of sync with the time, causing the "Release file for http://security.debian.org/debian-security/dists/bullseye-security/InRelease is not valid yet invalid for another 45min 21s" error

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jul 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants