Sha*_*ash 39 package-management
我正在尝试使用 dockerfile 更新 ubuntu 容器。
RUN apt-get update -y
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误。
E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 9h 14min 10s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease is not valid yet (invalid for another 9h 14min 16s). Updates for this repository will not be applied.
E: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease is not valid yet (invalid for another 9h 14min 35s). Updates for this repository will not be applied.
Run Code Online (Sandbox Code Playgroud)
我检查了相同问题的其他一些解决方案,例如添加Acquire::Check-Valid-Until=false到下面的 apt-get
RUN apt-get -o Acquire::Check-Valid-Until="false" update -y
Run Code Online (Sandbox Code Playgroud)
以上也失败了。
Den*_*nis 63
docker由于系统时钟不匹配,因此重新启动(或确定您的计算机)。我花了几个小时试图弄清楚发生了什么,然后重新启动立即修复了它。
gui*_*erc 29
更正您的系统时钟。(在评论中,我还建议检查时钟和时区之间是否不匹配)
请参阅更改系统时钟的命令行语句是什么?用于设置系统时间(如果使用“现代”Ubuntu 版本,我建议timedatectl使用答案),或http://manpages.ubuntu.com/manpages/xenial/man8/hwclock.8.html(如果您想设置硬件直接时钟;但请记住将其与您的时区配置相匹配)
Rub*_*ens 18
如果您正在使用 Docker,那么最近在 2.2.0 中引入了一个错误,该错误会导致主机进入睡眠状态时出现时间漂移。这会使所有正在运行的 docker 容器不同步,从而导致诸如此类的错误。
请参阅https://github.com/docker/for-win/issues/5593以跟踪解决方案和变通方法。
这是在 2018 年被问到的,当时 Docker 中还没有这个错误。现在,这个错误存在,所以这个错误可能是今天找到这篇文章的人的问题。
小智 11
我已经解决了更新时间的问题:
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
sudo apt update
Run Code Online (Sandbox Code Playgroud)
小智 6
这对我不起作用:
apt-get -o Acquire::Check-Valid-Until="false" update
Run Code Online (Sandbox Code Playgroud)
但这确实:
apt-get -o Acquire::Max-FutureTime=86400 update
Run Code Online (Sandbox Code Playgroud)
86400 是一天中的秒数。如果您的时钟超过这个时间,您将需要增加它。
警告:引号可能会导致它将数字视为字符串。shell 通常会删除一组引号,但 shell 只会删除-o 'Acquire::Max-FutureTime="86400"'单引号,而 apt-get 会看到数字周围的双引号。
我试过这个是因为GetNotBefore()在acquire-item.cc 中返回d->NotBefore似乎只受到影响Acquire::Max-FutureTime。
https://github.com/Debian/apt/blob/master/apt-pkg/acquire-item.cc#L1758-L1775 https://github.com/Debian/apt/blob/master/apt-pkg/deb /debmetaindex.cc#L543-L555
小智 6
这帮助我在 docker 中修复了时间:
docker run --rm --privileged alpine hwclock -s
Run Code Online (Sandbox Code Playgroud)
小智 5
sudo hwclock -s
Run Code Online (Sandbox Code Playgroud)
帮助我解决了这个问题。
在 WSL 2 Windows 10 19603 上运行的 Docker 2.2.3.0
| 归档时间: |
|
| 查看次数: |
47253 次 |
| 最近记录: |