Need help?

Our experts have had an average response time of 13.52 minutes in October 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Why is DEBIAN_FRONTEND=noninteractive discouraged in Docker files?

by | Feb 25, 2021

Are you willing to set DEBIAN_FRONTEND=noninteractive in docker so that no question/dialog is asked during apt-get install? Have a look at this blog to know why we discourage it.

noninteractive mode is useful when we need zero interaction while installing or upgrading the system via apt. However, setting this environment variable to noninteractive has an adverse effect. Because it is inherited by all images and containers built from the image, effectively changing their behavior.

Setting DEBIAN_FRONTEND to noninteractive is mainly a ‘cosmetic’ change, we highly discourage changing it.

Here at Bobcares, we have seen several such Docker-related queries as part of our Docker Hosting Support for Docker users, web hosts, and online service providers.

Today we’ll discuss why we discourage changing the default value of DEBIAN_FRONTEND.

 

Why is DEBIAN_FRONTEND=noninteractive discouraged in Docker files?

Now let’s discuss why our Support Engineers suggest not to set DEBIAN_FRONTEND to noninteractive.

Generally, while building Docker images on Debian and Ubuntu you may have seen errors like:

unable to initialize frontend: Dialog

However, these errors don’t stop the building of the image instead it informs you that the installation process tried to open a dialog box, but couldn’t. Generally, we can safely ignore these errors.

In some cases, few people try to change this environment variable inside the Dockerfile using:

ENV DEBIAN_FRONTEND=noninteractive

This prevents the installer from opening dialog boxes during the installation process. As a result, it stops the errors from displaying.

This might sound like a good idea but it may have side effects.

 

Common error setting DEBIAN_FRONTEND=noninteractive in docker

Now let’s take a look at an error our customer came across and also let’s see the solution our Support Engineers provide.

One of our customers set the following environment so that no question/dialog pops up during apt-get install:

ENV DEBIAN_FRONTEND noninteractive # export DEBIAN_FRONTEND="noninteractive"

Then while building an image from a Dockerfile, at the end of one specific Debian/Ubuntu package install (using apt-get install), package configuration debconf says:

debconf: unable to initialize frontend: Noninteractive # export DEBIAN_FRONTEND="noninteractive"
debconf: (Bareword "Debconf::FrontEnd::Noninteractive" not allowed while "strict subs" in use at (eval 35) line 3, <> line 1.)
debconf: falling back to frontend: Noninteractive
Subroutine BEGIN redefined at (eval 36) line 2, <> line 1.

First of all, we highly discourage setting DEBIAN_FRONTEND to noninteractive via ENV. Because the environment variable persists after the build, e.g. when you run docker exec -it … bash. The setting would not make sense here.

Here are the two possible ways:

Setting it via ARG as this is only available during build:

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq install {your-package}

When required, setting it on-the-fly.

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -qq install {your-package}

[Need any further assistance with Docker-related queries? – We’re available 24*7]

 

Conclusion

In short, setting the DEBIAN_FRONTEND value to noninteractive is a ‘cosmetic’ change, we highly discourage changing it. If you really need to change its setting, make sure to change it back to its default value afterward. Today, we saw how our Support Engineers resolve its related error.

Are you using Docker based apps?

There are proven ways to get even more out of your Docker containers! Let us help you.

Spend your time in growing business and we will take care of Docker Infrastructure for you.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF