首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Docker:安装apt-utils时出现问题

Docker:安装apt-utils时出现问题
EN

Stack Overflow用户
提问于 2018-06-25 20:17:08
回答 4查看 130.3K关注 0票数 155

我正在尝试在Docker上安装apt-utils,因为当我刚刚执行apt-get update时,我收到了错误:debconf: delaying package configuration, since apt-utils is not installed。因此,我添加了一行代码来安装apt-utils (以及curl):

代码语言:javascript
运行
复制
RUN apt-get update && apt-get install -y apt-utils && apt-get install -y curl

但是,我仍然得到那个错误,使我相信我的命令不起作用。下面是我尝试构建镜像时的输出。

代码语言:javascript
运行
复制
Step 5/12 : RUN apt-get update && apt-get install -y apt-utils && apt-get install -y curl
 ---> Running in 6e6565ff01bd
Get:1 http://security.debian.org jessie/updates InRelease [94.4 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:3 http://deb.debian.org jessie Release.gpg [2420 B]
Get:4 http://deb.debian.org jessie Release [148 kB]
Get:5 http://security.debian.org jessie/updates/main amd64 Packages [624 kB]
Get:6 http://deb.debian.org jessie-updates/main amd64 Packages [23.0 kB]
Get:7 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
Fetched 10.1 MB in 6s (1541 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libapt-inst1.5
The following NEW packages will be installed:
  apt-utils libapt-inst1.5
0 upgraded, 2 newly installed, 0 to remove and 24 not upgraded.
Need to get 537 kB of archives.
After this operation, 1333 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian/ jessie/main libapt-inst1.5 amd64 1.0.9.8.4 [169 kB]
Get:2 http://deb.debian.org/debian/ jessie/main apt-utils amd64 1.0.9.8.4 [368 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 537 kB in 0s (557 kB/s)
Selecting previously unselected package libapt-inst1.5:amd64.
(Reading database ... 21676 files and directories currently installed.)
Preparing to unpack .../libapt-inst1.5_1.0.9.8.4_amd64.deb ...
Unpacking libapt-inst1.5:amd64 (1.0.9.8.4) ...
Selecting previously unselected package apt-utils.
Preparing to unpack .../apt-utils_1.0.9.8.4_amd64.deb ...
Unpacking apt-utils (1.0.9.8.4) ...
Setting up libapt-inst1.5:amd64 (1.0.9.8.4) ...
Setting up apt-utils (1.0.9.8.4) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...
Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
Removing intermediate container 6e6565ff01bd
 ---> f65e29c6a6b9
Step 6/12 : RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
 ---> Running in f5764ba56103
Detected operating system as debian/8.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing debian-archive-keyring which is needed for installing
apt-transport-https on many Debian systems.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/github_git-lfs.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.

The repository is setup! You can now install packages.
Removing intermediate container f5764ba56103
 ---> a4e64687ab73

是什么导致了这个问题?我该如何修复它?谢谢!

EN

Stack Overflow用户

发布于 2021-03-09 15:28:17

这是一个持续的问题,没有很好的解决方案。我用了这个,它不是最优的,但它是有效的:

代码语言:javascript
运行
复制
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y apt-utils 2>&1 | \
    grep -v "^debconf: delaying package configuration, since apt-utils.*"

解释:

  • grep -v反向匹配,以其开头的行将消失!
  • ARG是新的ENV,如果您在运行时不需要它。
  • 然后我们可以使用apt-get一整天,而不会在从头开始构建图像时显示错误。

证明这是可行的:https://asciinema.org/a/WJCDEYcxCIy6EF7eXw0MAnK3c

票数 0
EN
查看全部 4 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51023312

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档