更新apt会破坏我在Ubuntu 18.04上的Docker构建

hwamh0ep  于 2023-03-29  发布在  Docker
关注(0)|答案(2)|浏览(217)

我在docker中更新apt时遇到了问题。目前我已经注解掉了整个dockerfile,除了以下内容:

FROM ubuntu:18.04
RUN apt update

基本上我必须先做apt update,因为没有它,ubuntu包管理器就无法工作。然而,这一行破坏了我的docker构建:

(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而不破坏我的构建吗?

cnh2zyt3

cnh2zyt31#

您可以尝试apt-get update,它应该工作,或者您可以检查时区,如果没有工作。

FROM ubuntu:18.04
apt-get update
n7taea2i

n7taea2i2#

正如@Adiii的评论所建议的那样,这对我很有效:

apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update

相关问题