I am trying to install apt-utils
on Docker because when I was just doing apt-get update
, I was getting the error: debconf: delaying package confi
After searching over the Internet, I have found some alternatives worth to be mentioned, instead of every time putting DEBIAN_FRONTEND=noninteractive
in front of apt-get install -y {your-pkgs}
:
Alternative 1: ARG DEBIAN_FRONTEND=noninteractive
The ARG instruction defines a variable that users can pass at build-time to the builder with the docker build command using the --build-arg = flag. (Reference: [6])
Solution characteristics:
ARG
directive is set only during the builddocker build --build-arg DEBIAN_FRONTEND=newt
Example:
ARG DEBIAN_FRONTEND=noninteractive
...
RUN apt-get -yq install {your-pkgs}
Alternative 2: On-the-fly
It is the solution from Leo K.
Solution characteristics:
RUN
and won't affect other directives.Example:
RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install {your-pkgs}
Alternative 3: ENV DEBIAN_FRONTEND=noninteractive
Setting ENV DEBIAN_FRONTEND noninteractive
would also be an alternative but it is highly discouraged.
Another way would be to set at the begging and unset it at the end of the Dockerfile.
Solution characteristics:
ENV
directive will persists the environment variable after the build (not recommended), furthermoreENV
, it will be inherited by all images and containes built from the image, effectively changing their behaviour. (As mentioned in [1]) People using those images run into problems when installing software interactively, because installers do not show any dialog boxes.DEBIAN_FRONTEND=newt
(see [2], so it has to be set at the end of the file.Example:
# Set for all apt-get install, must be at the very beginning of the Dockerfile.
ENV DEBIAN_FRONTEND noninteractive
...
# Non-interactive modes get set back.
ENV DEBIAN_FRONTEND newt
Alternative 4: RUN export DEBIAN_FRONTEND=noninteractive
Solution characteristics:
RUN
and won't affect other directives.Example:
# Set the frontend and then install your package
RUN export DEBIAN_FRONTEND=noninteractive && \
...
apt-get -yq install {your-pkgs} && \
...
More to read (references)
This is not actually an error and it is safe to ignore it. I have built a large number of container images without ever having apt-utils on any of them and regardless of this warning message, all package installs go through and work normally.
Anyway, if you want to have apt-utils - install it. It will give you this warning once and then it will disappear for future invocations of apt-get (as you can see in your own log, curl
got installed without that message).
NOTE if you install apt-utils, you will get other warnings (because now the installer can run interactive config and will attempt that and fail). To suppress those and have packages that have interactive config with their defaults, run apt-get like this DEBIAN_FRONTEND=noninteractive apt-get install -y pkgs....