在docker build期间如何接受许可协议?

问题描述 投票:1回答:2

如何编写可以传递yes的Dockerfile来提示许可协议?

  1. 在Dockerfile目录下,docker build -t "{user}/{tags}" .然后构建失败。
  2. docker logs {container id},显示如下信息: Preparing to unpack .../ttf-mscorefonts-installer_3.4+nmu1ubuntu2_all.deb ... debconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) debconf: falling back to frontend: Readline Configuring ttf-mscorefonts-installer TrueType core fonts for the Web EULA END-USER LICENSE AGREEMENT FOR MICROSOFT SOFTWARE ... Do you accept the EULA license terms? [yes/no]
docker ubuntu-16.04
2个回答
3
投票

跟随在这里issue: [16.04] debconf: delaying package configuration, since apt-utils is not installed的讨论。

我在Dockerfile中添加了这三行代码:

ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND teletype

RUN apt-get update -y && apt-get install -y --no-install-recommends apt-utils \

最后成功构建了docker镜像!


0
投票

您可以基于此尝试此解决方案:https://unix.stackexchange.com/a/106553

  1. 首先手动安装软件包(即在现有容器上,在本地计算机上)
    $ apt-get install -y PACKAGE
  1. 安装完成后,获取许可证的debconf设置
    $ debconf-get-selections | grep PACKAGE
    PACKAGE    PACKAGE/key    string    y
  1. 现在使用Dockerfile构建映像:
    ENV DEBIAN_FRONTEND=teletype
    RUN echo PACKAGE PACKAGE/key type string y | debconf-set-selections && \
        apt-get install -y PACKAGE

您可能需要为debconf-utils安装debconf-set|get-selections


-2
投票

您可以在Dockerfile中的行末写一个-y

例:

RUN         apt-get update
RUN         apt-get install netcat -y
© www.soinside.com 2019 - 2024. All rights reserved.