How to accept license agreement during docker build?

Show Details

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

  1. Install the package manually first (i.e. on an existing container, on a local machine)
    $ apt-get install -y PACKAGE
    
  2. Once it's installed, get the debconf setting for the license
    $ debconf-get-selections | grep PACKAGE
    PACKAGE    PACKAGE/license    string    y
    
  3. 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: enter image description here

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

Maybe that helps :)


Solution 5: [5]

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


Credits

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Credit
Solution 1 Lucas Carlos Barboza
Solution 2 stackoverYC
Solution 3 Gino Mempin
Solution 4 frietz58
Solution 5 Kilian