When trying to build my ubuntu-based Docker container (Docker for Windows), all of a sudden I get an error similar to
E: Release file for is not valid yet (invalid for another 9h 55min 59s). Updates for this repository will not be applied.and the build fails. How can I fix this?
3 Answers
Please try this command.
sudo hwclock --hctosys
I fixed the error by above commands.
It's just about date and time, mine has fixed with this:
sudo service ntp restart It turns out Docker for Windows has a problem with clock drift (potentially due to laptop sleep).
Solution was to adjust system clock in Docker, e.g.
>docker run --privileged -it ubuntu:20.04
root@0b05be0fc8b6:/# date +%T -s "12:21:43"assuming "12:21:43" is current time in UTC.
Edit: The problem reappeared and looks to be related to Hyper-V and laptop low battery sleep. I upgraded to the latest Windows 10 and switched Docker to use WSL2 instead of the deprecated Hyper-V and the problem is finally gone.