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]
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 Successfully built the docker image !
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
debconf
setting for the license
$ debconf-get-selections | grep PACKAGE
PACKAGE PACKAGE/license string y
- Now to build the image with a the 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
.
You can write a -y
at the end of your line in the Dockerfile.
Example:
RUN apt-get update
RUN apt-get install netcat -y