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

Comments

Projects
None yet
9 participants
@SvenDowideit
Copy link
Contributor

SvenDowideit commented Feb 10, 2014

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

SvenDowideit commented Feb 10, 2014

/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

This comment has been minimized.

Copy link
Contributor

SvenDowideit commented Feb 14, 2014

closed by #4035

@pmorch

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

shaunc commented Mar 29, 2015

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

@duglin

This comment has been minimized.

Copy link
Contributor

duglin commented Mar 29, 2015

hmmm #9176 :-)

yous added a commit to yous/pinpoint-docker that referenced this issue May 6, 2015

Set environment variables inline
`DEBIAN_FRONTEND` environment variable remains all time. We need it to
be `noninteractive` only when we do `apt-get install`. See
moby/moby#4032.

This was referenced Jul 13, 2015

bhalothia added a commit to bhalothia/docker-rundeck that referenced this issue Oct 6, 2015

@drastik

This comment has been minimized.

Copy link

drastik commented Dec 10, 2015

What is the consensus on the best practice here?

@thaJeztah

This comment has been minimized.

Copy link
Member

thaJeztah commented Dec 10, 2015

@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

Only set DEBIAN_FRONTEND during build
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

This comment has been minimized.

Copy link

markriggins commented Mar 4, 2016

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

ARG DEBIAN_FRONTEND=noninteractive

edouard-lopez added a commit to edouard-lopez/docker-restyaboard that referenced this issue Mar 17, 2016

set ENV TERM and ENV DEBIAN_FRONTEND to prevent useless error
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 added a commit to edouard-lopez/docker-restyaboard that referenced this issue Mar 17, 2016

set ENV TERM and ENV DEBIAN_FRONTEND to prevent useless error
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

michael-k added a commit to michael-k/mailcow-dockerized that referenced this issue May 13, 2017

[Dockerfiles] Do not persist DEBIAN_FRONTEND=noninteractive in images
According to moby/moby#4032 (comment)
(and some other comments in the issue) it's not recommended to set
`DEBIAN_FRONTEND` via `ENV` in a Dockerfile.  `ARG` has the same
effect at build time but does not change `DEBIAN_FRONTEND` in the
final image, so I switched to it.  It should also work to remove it
completely.

michael-k added a commit to michael-k/mailcow-dockerized that referenced this issue May 13, 2017

[Dockerfiles] Do not persist DEBIAN_FRONTEND=noninteractive in images
According to moby/moby#4032 (comment)
(and some other comments in the issue) it's not recommended to set
`DEBIAN_FRONTEND` via `ENV` in a Dockerfile.  `ARG` has the same
effect at build time but does not change `DEBIAN_FRONTEND` in the
final image, so I switched to it.  It should also work to remove it
completely.

jacobalberty added a commit to jacobalberty/unifi-docker that referenced this issue Jul 20, 2017

jacobalberty added a commit to jacobalberty/unifi-docker that referenced this issue Jul 20, 2017

jacobalberty added a commit to jacobalberty/unifi-docker that referenced this issue Jul 20, 2017

jacobalberty pushed a commit to jacobalberty/cups-docker that referenced this issue Jul 24, 2017

zoidbergwill added a commit to zoidbergwill/bcc-docker that referenced this issue Dec 5, 2017

zoidbergwill added a commit to zoidbergwill/bcc-docker that referenced this issue Dec 5, 2017

We only wanna set DEBIAN_FRONTEND on install
Otherwise when we run bash in the container it
still is set, and Docker doesn't yet support env vars
for just build time.

moby/moby#4032

bdevans added a commit to bdevans/chaste-docker that referenced this issue Jan 17, 2018

jenkins-attcomdev pushed a commit to att-comdev/shipyard that referenced this issue Apr 16, 2018

Update Airflow/Shipyard Dockerfile
As mentioned in [0], the best practice is NOT to use ENV for
DEBIAN_FRONTEND as it will persists in the final image. It
appears that the common consensus is to use ARG instead so
that noninteractive DEBIAN_FRONTEND is set only during build.

[0] moby/moby#4032

Change-Id: I6980e140ee5a51596a2f9ba4e1471e2c98599846

tomasfejfar added a commit to keboola/db-writer-mssql that referenced this issue May 3, 2018

tomasfejfar added a commit to keboola/db-writer-mssql that referenced this issue May 4, 2018

MiroCillik added a commit to keboola/db-writer-mssql that referenced this issue May 9, 2018

erikmd added a commit to erikmd/coq-images that referenced this issue Aug 12, 2018

@armab armab referenced this issue Oct 4, 2018

Merged

Add Dockerfiles #1

SkypLabs added a commit to SkypLabs/ble-micro-dockerfile that referenced this issue Nov 27, 2018

SkypLabs added a commit to SkypLabs/monkey that referenced this issue Nov 27, 2018

Add 'DEBIAN_FRONTEND' as 'ARG'
Using 'ARG' instead of 'ENV' allows to define environment variables only
for the build stage. See
moby/moby#4032 (comment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment