【发布时间】:2020-07-01 00:51:22
【问题描述】:
我在 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 而不会破坏我的构建?
【问题讨论】:
-
你在代理后面吗?或者你可以试试
FROM ubuntu:18.04 RUN apt-get update或RUN apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update -
这真的很奇怪 - 使用
apt-get update有效,但apt无效。我的印象是它们是同一回事。无论如何 - 谢谢,当然不会单独想出那个。