更新 apt 破坏了我在 Ubuntu 18.04 上的 docker 构建

Updating apt breaks my docker build on Ubuntu 18.04

我 运行 从 docker 更新 apt 时遇到问题。目前我已将整个 docker 文件注释掉,除了这个:

FROM ubuntu:18.04
RUN apt update 

基本上我必须先做 apt update 因为没有它 ubuntu 包管理器将无法工作。但是,这条线破坏了我的 docker build:

(pyomexmeta-test) ciaran@DESKTOP-K0APGUV:/mnt/d/libOmexMeta$ DOCKER_BUILDKIT=1 docker build -t  pyomexmeta:v-0.0.13 .
[+] Building 7.6s (5/5) FINISHED
 => [internal] load .dockerignore                                                                                                                         0.1s
 => => transferring context: 34B                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                      0.1s
 => => transferring dockerfile: 2.04kB                                                                                                                    0.0s
 => [internal] load metadata for docker.io/library/ubuntu:18.04                                                                                           0.0s
 => CACHED [1/2] FROM docker.io/library/ubuntu:18.04                                                                                                      0.0s
 => ERROR [2/2] RUN APT update                                                                                                                            7.5s
------
 > [2/2] RUN    APT update:
#5 0.240
#5 0.240 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#5 0.240
#5 0.355 Get:1 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
#5 0.495 Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
#5 0.558 Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
#5 0.649 Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
#5 0.742 Get:5 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
#5 1.323 Get:6 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
#5 1.392 Get:7 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
#5 6.281 Get:8 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]
#5 6.897 Reading package lists...
#5 7.438 E: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease is not valid yet (invalid for another 19h 35min 45s). Updates for this repository will not be applied.
#5 7.438 E: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease is not valid yet (invalid for another 19h 37min 17s). Updates for this repository will not be applied.
#5 7.438 E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 19h 34min 38s). Updates for this repository will not be applied.
------
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c apt update]: runc did not terminate sucessfully
(pyomexmeta-test) ciaran@DESKTOP-K0APGUV:/mnt/d/libOmexMeta$ echo $http_proxy

我也尝试过不使用 DOCKER_BUILDKIT=1 变量,但结果相同(尽管速度较慢)。

我猜这是一些基本的东西,因为我是 docker 的新手,但是有人可以建议我如何在不破坏我的构建的情况下更新 apt 吗?

您可以尝试 apt-get update 它应该可以工作,或者您可以检查时区是否不起作用。

FROM ubuntu:18.04
apt-get update