我正在尝试apt-utils在Docker 上安装,因为当我刚刚做的时候apt-get update,我收到了错误:debconf: delaying package configuration, since apt-utils is not installed.所以我添加了一行安装apt-utils(连同curl):
RUN apt-get update && apt-get install -y apt-utils && apt-get install -y curl
Run Code Online (Sandbox Code Playgroud)
但是,我仍然遇到这个错误,导致我相信我的命令不起作用.当我尝试构建图像时,下面是我的输出.
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
Run Code Online (Sandbox Code Playgroud)
造成这种情况的原因是什么?如何解决?谢谢!
Leo*_*o K 58
这实际上不是一个错误,忽略它是安全的.我已经构建了大量的容器映像而没有任何apt-utils,无论这个警告消息如何,所有的软件包安装都会正常运行.
无论如何,如果你想要apt-utils - 安装它.它会给你一次这个警告,然后它会在以后调用apt-get时消失(正如你在自己的日志中看到的那样,curl没有那条消息就安装了).
注意如果您安装apt-utils,您将收到其他警告(因为现在安装程序可以运行交互式配置并将尝试并失败).要取消这些并使包含具有默认值的交互式配置的包,请像这样运行apt-getDEBIAN_FRONTEND=noninteractive apt-get install -y pkgs....
Key*_*r00 15
搜索在互联网上后,我已经找到了一些替代品值得一提的,而不是每次投入时间DEBIAN_FRONTEND=noninteractive在前面apt-get install -y {your-pkgs}:
选择1:ARG DEBIAN_FRONTEND =非交互式
ARG指令定义了一个变量,用户可以在构建时使用--build-arg =标志使用docker build命令将其传递给构建器。(参考:[ 6 ])
解决方案特点:
ARG 指令仅在构建期间设置docker build --build-arg DEBIAN_FRONTEND=newt例:
ARG DEBIAN_FRONTEND=noninteractive
...
RUN apt-get -yq install {your-pkgs}
Run Code Online (Sandbox Code Playgroud)
选择2:即时
这是Leo K的解决方案。
解决方案特点:
RUN,不会影响其他指令。例:
RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install {your-pkgs}
Run Code Online (Sandbox Code Playgroud)
选择3:ENV DEBIAN_FRONTEND =非交互式
设置ENV DEBIAN_FRONTEND noninteractive也是一种替代方法,但是强烈建议不要这样做。
另一种方法是在乞讨处设置,在Dockerfile的末尾取消设置。
解决方案特点:
ENV 指令将在构建后保留环境变量(不推荐),此外ENV,它将被所有图像继承,并从图像中构建容器,从而有效地改变其行为。(如[ 1 ]中所述),以交互方式安装软件时,使用这些映像的人会遇到问题,因为安装程序不会显示任何对话框。DEBIAN_FRONTEND=newt(请参阅[ 2 ],因此必须在文件末尾设置它。例:
# Set for all apt-get install, must be at the very beginning of the Dockerfile.
ENV DEBIAN_FRONTEND noninteractive
...
# Non-interactive modes get set back.
ENV DEBIAN_FRONTEND newt
Run Code Online (Sandbox Code Playgroud)
备选方案4:RUN导出DEBIAN_FRONTEND =非交互式
解决方案特点:
RUN,不会影响其他指令。例:
# Set the frontend and then install your package
RUN export DEBIAN_FRONTEND=noninteractive && \
...
apt-get -yq install {your-pkgs} && \
...
Run Code Online (Sandbox Code Playgroud)
阅读更多(参考)
| 归档时间: |
|
| 查看次数: |
32084 次 |
| 最近记录: |