Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is it possible to somehow answer the questions that are presented as dialogs when installing some packages using apt-get?

For instance I'm trying to setup a container containing the mail-stack-delivery package with:

FROM ubuntu

RUN apt-get install -y mail-stack-delivery

However that dockerfile generates dozens of errors when built that are along the lines of:

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: (Can't locate Term/ReadLine.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7, <> line 11.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 

From what I understand I just simply can't respond to the dialogs, but is there some way that I can pass a parameter to answer each question in advance? I know that it's just changing some configurations, so I could do it after the fact, but presumably it's better to let the install scripts do it so everything gets set properly.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.4k views
Welcome To Ask or Share your Answers For Others

1 Answer

See the discussion here: https://github.com/docker/docker/issues/4032. In short, setting ENV DEBIAN_FRONTEND noninteractive is not recommended as it persists in the final image, even when running something like docker run -i -t ... bash. Therefore it is recommended either to omit DEBIAN_FRONTEND and live with the warning, or specify it explicitly for each command e.g. RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q package.

Fortunately, the new ARG directive sets variables that only live during the build so a more elegant solution is now possible that's specified in the DockerFile yet does not persist in the final image: ARG DEBIAN_FRONTEND=noninteractive.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...