'How to accept license agreement during docker build?
How to write the Dockerfile that can pass yes to prompting license agreement?
- under Dockerfile directory,
docker build -t "{user}/{tags}" .then build failed. docker logs {container id}, show message as below: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]
Solution 1:[1]
For me, the ACCEPT_EULA=y before the install did the job, like
RUN apt-get update && ACCEPT_EULA=Y apt-get install PACKAGE -y
Solution 2:[2]
Follow by discuession here issue: [16.04] debconf: delaying package configuration, since apt-utils is not installed.
I added these three lines of codes in Dockerfile:
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND teletype
RUN apt-get update -y && apt-get install -y --no-install-recommends apt-utils \
Finally I can build the docker image !
Solution 3:[3]
You can try this solution based on this: https://unix.stackexchange.com/a/106553
- Install the package manually first (i.e. on an existing container, on a local machine)
$ apt-get install -y PACKAGE - Once it's installed, get the
debconfsetting for the license$ debconf-get-selections | grep PACKAGE PACKAGE PACKAGE/license string y - Now to build the Docker image with a Dockerfile:
ARG DEBIAN_FRONTEND=noninteractive RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \ echo PACKAGE PACKAGE/license string y | debconf-set-selections && \ apt-get install -y PACKAGE
You might need to install debconf-utils for debconf-set|get-selections.
Solution 4:[4]
I was able to agree to a license during the build process of a Dockerfile by piping the installation that required the confirmation with the yes command, which spams y or yes to any confirmation prompt (see here). Before, my build process was still getting stuck on the [yes/no] prompt like you describe. Note, that the steps described in this answer are still required. Without them, the yes command doesn't seem to be enough, as the build process still gets stuck on the [yes/no] prompt.
This is what I have in my dockerfile:
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND teletype
RUN yes | apt-get install <package>
With that, I can automatically accept prompts in the terminal:

It actually also works for these "debian confirmation dialogues" (don't know the correct term):

Maybe that helps :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | vs97 |
| Solution 2 | |
| Solution 3 | |
| Solution 4 |
