Is it possible to answer dialog questions when installing under docker?

See the discussion here: https://github.com/docker/docker/issues/4032. In short, setting ENV DEBIAN_FRONTEND noninteractive is not recommended as it persists in the final image, even when running something like docker run -i -t ... bash. Therefore it is recommended either to omit DEBIAN_FRONTEND and live with the warning, or specify it explicitly for each command e.g. RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q package.

Fortunately, the new ARG directive sets variables that only live during the build so a more elegant solution is now possible that's specified in the DockerFile yet does not persist in the final image: ARG DEBIAN_FRONTEND=noninteractive.


As usual, a little more searching found the answer.

The answer is debconf-set-selections. Manpage: http://manpages.ubuntu.com/manpages/oneiric/en/man1/debconf-set-selections.1.html

To find the options that can be set use debconf-get-selections on a system that already has the package installed. You'll need to install debconf-utils for the second command.


You should set DEBIAN_FRONTEND=noninteractive as an envvar. In most cases this will at least make it so the installation doesn't error out.

Also as @Azdle mentioned, using debconf-set-selections will let you set specific items.