Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENV DEBIAN_FRONTEND noninteractive #4032

Closed
SvenDowideit opened this issue Feb 10, 2014 · 10 comments
Closed

ENV DEBIAN_FRONTEND noninteractive #4032

SvenDowideit opened this issue Feb 10, 2014 · 10 comments

Comments

@SvenDowideit
Copy link
Contributor

should we really expect users of our deb base images to add

ENV DEBIAN_FRONTEND noninteractive to the start of all their Dockerfiles, or is this actually a reasonable default that we could set for them?

@tianon
Copy link
Member

tianon commented Feb 10, 2014

This is definitely not a reasonable default, and setting it via ENV should be actively discouraged.

APT is smart enough to detect that it's not being run interactively, but it throws out some pretty ugly looking warnings (that thanks to our new build stuff are red now), and setting this hides them.

The reason it's not a good default is that if I docker run -i -t ... bash, I'm now interactive, and this variable being set is very, very wrong. This is exactly why it's set in-line in our root Dockerfile, and not via ENV (ie, RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq ...).

@SvenDowideit
Copy link
Contributor Author

/me ponders where to document that...

Does this mean Dockerfile authors should avoid using RUN DEBIAN_FRONTEND=noninteractive apt-get install ... until there's a problem and then only add it to those that fail, or that every apt-get line needs to be littered with something most of them won't even know exists?

(and awful lot of the postgreSQL example complains without)

alternativly, could I ENV set it at the top, and then ENV unset it after?

@SvenDowideit
Copy link
Contributor Author

closed by #4035

@pmorch
Copy link

pmorch commented Jun 15, 2014

I saw the note in the docs that

Note: One example where this can cause unexpected consequenses, is setting ENV DEBIAN_FRONTEND noninteractive. Which will persist when the container is run interactively; for example: docker run -t -i image bash

and am now thinking "Ok, so what should I do instead?" The subsquent google search landed me here. Neither this issue nor the docs give a clear recommendation...

So what is the canonical way to run apt-get install?

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q package

Seems to be the way to do it. @SvenDowideit hints at:

alternativly, could I ENV set it at the top, and then ENV unset it after?

But is it possible to "then ENV unset it after"? A single-arg:

ENV DEBIAN_FRONTEND

Doesn't work, and I can't find a undef/NULL/nil value for ENV in the docs.

I'd love to hear/read the canonical way to do it somewhere...

@czerasz
Copy link
Contributor

czerasz commented Jul 28, 2014

@pmorch You could just set it to it's default value

DEBIAN_FRONTEND=newt

Resource link

@shaunc
Copy link

shaunc commented Mar 29, 2015

Maybe there should be a BUILDENV command that just sets environment during build :)

@duglin
Copy link
Contributor

duglin commented Mar 29, 2015

hmmm #9176 :-)

@drastik
Copy link

drastik commented Dec 10, 2015

What is the consensus on the best practice here?

@thaJeztah
Copy link
Member

@drastik best practice is to not use ENV, because that will make the env-var persist in the final image.

In most cases, omitting "DEBIAN_FRONTEND" is harmless and only produces some warnings during build (which can be ignored). If really needed, RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q package should work

thoughtless added a commit to thoughtless/ripit that referenced this issue Dec 20, 2015
Do not set it in the resulting image, which is discouraged because the container may
be run interactively at some point.
With this particular container, an interactive run is quite likely.

See moby/moby#4032 (comment)
@markriggins
Copy link

The new ARG directive in the Dockerfile can set this only during the build

ARG DEBIAN_FRONTEND=noninteractive

edouard-lopez pushed a commit to edouard-lopez/docker-restyaboard that referenced this issue Mar 17, 2016
More info can be found in [docker issue #4032](moby/moby#4032 (comment))
Remove errors such as:
> debconf: unable to initialize frontend: Dialog
> debconf: (TERM is not set, so the dialog frontend is not usable.)
> debconf: falling back to frontend: Readline
> debconf: unable to initialize frontend: Readline
> debconf: (This frontend requires a controlling tty.)
> debconf: falling back to frontend: Teletype
edouard-lopez pushed a commit to edouard-lopez/docker-restyaboard that referenced this issue Mar 17, 2016
More info can be found in [docker issue #4032](moby/moby#4032 (comment))
Remove errors such as:
> debconf: unable to initialize frontend: Dialog
> debconf: (TERM is not set, so the dialog frontend is not usable.)
> debconf: falling back to frontend: Readline
> debconf: unable to initialize frontend: Readline
> debconf: (This frontend requires a controlling tty.)
> debconf: falling back to frontend: Teletype
adamradocz added a commit to BOINC/boinc-client-docker that referenced this issue Jun 3, 2019
…ng it via ENV should be actively discouraged, because if I docker run -i -t ... bash, I'm now interactive, and this variable being set is very, very wrong, according to this issue: moby/moby#4032.
adamradocz added a commit to BOINC/boinc-client-docker that referenced this issue Jun 3, 2019
…ng it via ENV should be actively discouraged, because if I docker run -i -t ... bash, I'm now interactive, and this variable being set is very, very wrong, according to this issue: moby/moby#4032. (#64)
SamBissig pushed a commit to toradex/debian-docker-images that referenced this issue Jul 19, 2019
Get rid of warnings during package configuration by specifying non-
interactive as DEBIAN_FRONTEND environment variable. Use ARG to make
sure that this environment variable is only set during build time.
Use ONBUILD ARG to make sure that non-interactive frontend is also
used in downstream builds. Docker builds are non-interactive by
nature so this should be a sensible default for downstream builds.

See also:
moby/moby#4032 (comment)

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
usmcfiredog added a commit to usmcfiredog/docker-ipsec-vpn-server that referenced this issue Sep 20, 2020
- Move DEBIAN_FRONTEND=noninteractive to inline (Ref: moby/moby#4032)
- Add fallback URL from GitHub for Libreswan source
zuka0828 pushed a commit to zuka0828/docker-aptly that referenced this issue Oct 13, 2020
ENV variables remain after the build.
moby/moby#4032 (comment)

Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
zuka0828 pushed a commit to zuka0828/docker-aptly that referenced this issue Oct 27, 2020
ENV variables remain after the build.
moby/moby#4032 (comment)

Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
urpylka pushed a commit to urpylka/docker-aptly that referenced this issue Nov 20, 2020
ENV variables remain after the build.
moby/moby#4032 (comment)

Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
SimonPhumin pushed a commit to SimonPhumin/container that referenced this issue Nov 29, 2020
diadatp added a commit to diadatp/gow that referenced this issue Sep 20, 2021
Using ENV is discouraged as the environment variable persists after the build, confusing apt.
See: moby/moby#4032 (comment)
nanake added a commit to nanake/ffmpeg-tinderbox that referenced this issue Jun 7, 2022
when required instead of ENV

Setting `ENV DEBIAN_FRONTEND=noninteractive` is highly discouraged
as per https://docs.docker.com/engine/faq/#why-is-debian_frontendnoninteractive-discouraged-in-dockerfiles
and moby/moby#4032 (comment)

Signed-off-by: nanake <nanake@users.noreply.github.com>
jfavellar90 added a commit to overhangio/tutor-xqueue that referenced this issue May 30, 2023
Using DEBIAN_FRONTEND as Docker ENV variable is discouraged: moby/moby#4032 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants