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 configuration, since apt-utils is not installed
. So I added a line to install apt-utils
(along with curl
):
RUN apt-get update && apt-get install -y apt-utils && apt-get install -y curl
But, I am still getting that error leading me to believe that my command didn't work. Below is my output when I try to build the image.
Step 5/12 : RUN apt-get update && apt-get install -y apt-utils && apt-get install -y curl
---> Running in 6e6565ff01bd
Get:1 http://security.debian.org jessie/updates InRelease [94.4 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:3 http://deb.debian.org jessie Release.gpg [2420 B]
Get:4 http://deb.debian.org jessie Release [148 kB]
Get:5 http://security.debian.org jessie/updates/main amd64 Packages [624 kB]
Get:6 http://deb.debian.org jessie-updates/main amd64 Packages [23.0 kB]
Get:7 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
Fetched 10.1 MB in 6s (1541 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
libapt-inst1.5
The following NEW packages will be installed:
apt-utils libapt-inst1.5
0 upgraded, 2 newly installed, 0 to remove and 24 not upgraded.
Need to get 537 kB of archives.
After this operation, 1333 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian/ jessie/main libapt-inst1.5 amd64 1.0.9.8.4 [169 kB]
Get:2 http://deb.debian.org/debian/ jessie/main apt-utils amd64 1.0.9.8.4 [368 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 537 kB in 0s (557 kB/s)
Selecting previously unselected package libapt-inst1.5:amd64.
(Reading database ... 21676 files and directories currently installed.)
Preparing to unpack .../libapt-inst1.5_1.0.9.8.4_amd64.deb ...
Unpacking libapt-inst1.5:amd64 (1.0.9.8.4) ...
Selecting previously unselected package apt-utils.
Preparing to unpack .../apt-utils_1.0.9.8.4_amd64.deb ...
Unpacking apt-utils (1.0.9.8.4) ...
Setting up libapt-inst1.5:amd64 (1.0.9.8.4) ...
Setting up apt-utils (1.0.9.8.4) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...
Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
Removing intermediate container 6e6565ff01bd
---> f65e29c6a6b9
Step 6/12 : RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
---> Running in f5764ba56103
Detected operating system as debian/8.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing debian-archive-keyring which is needed for installing
apt-transport-https on many Debian systems.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/github_git-lfs.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.
The repository is setup! You can now install packages.
Removing intermediate container f5764ba56103
---> a4e64687ab73
What is causing this and how can I fix it?
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....
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
Important: According to the feedbacks alternative 2 & 3 work for most of you, while alternative 1 does not. This is why this alternative is crossed, but is kept for traceability & completeness sake.
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 beginning 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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With