Code Monkey home page Code Monkey logo

Comments (41)

famelis avatar famelis commented on May 31, 2024 141

I use docker on Debian/Jessie.

In the Dockerfile of a container

FROM debian:sid

I set, before the first apt-get,

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

and everything is ok.

from baseimage-docker.

FooBarWidget avatar FooBarWidget commented on May 31, 2024 57

Not a baseimage-docker issue. You need to set DEBIAN_FRONTEND to noninteractive.

from baseimage-docker.

nikolay avatar nikolay commented on May 31, 2024 40

@FooBarWidget Yes, I'm building on top of your base image:

FROM phusion/baseimage:0.9.9

ENV HOME /root
ENV DEBIAN_FRONTEND noninteractive

RUN /etc/my_init.d/00_regen_ssh_host_keys.sh

ENTRYPOINT ["/sbin/my_init"]

ADD . /build
RUN run-parts --regex "^[0-9]+\-[0-9a-z-]+\.sh$" /build/bin

EXPOSE 80

I just added export DEBIAN_FRONTEND="noninteractive" to each of those /build/bin scripts, but it doesn't solve the problem either.

from baseimage-docker.

nikolay avatar nikolay commented on May 31, 2024 39

@FooBarWidget I do have set that both with ENV DEBIAN_FRONTEND noninteractive and then explicitly setting it within my scripts with export DEBIAN_FRONTEND="noninteractive", but I still see the above on every package installation.

from baseimage-docker.

micheleorsi avatar micheleorsi commented on May 31, 2024 21

ENV DEBIAN_FRONTEND noninteractive
worked as well to me!

from baseimage-docker.

famelis avatar famelis commented on May 31, 2024 20

@nikolay This line instructs debconf to store in its database an answer for the program debconf.
If (the running program) debconf later asks (the database of answers) debconf what is my frontend the answer will be frontend is Noninteractive.

It has nothing to do with the interactivity of ssh or bash.

You can change how debconf interacts either with a similar line eg.

echo 'debconf debconf/frontend select Dialog' | debconf-set-selections

or by using

dpkg-reconfigure debconf

The debconf-set-selections is part of the debconf package. There is also a debconf-get-selections, which is part of the debconf-utils package, that displays the stored answers in the debconf database.

from baseimage-docker.

christianbundy avatar christianbundy commented on May 31, 2024 20

👍 for ENV DEBIAN_FRONTEND noninteractive

from baseimage-docker.

n3ziniuka5 avatar n3ziniuka5 commented on May 31, 2024 17

This worked for me:
ENV DEBIAN_FRONTEND noninteractive

from baseimage-docker.

aureliojargas avatar aureliojargas commented on May 31, 2024 17

Using ARG instead of ENV would set the variable just for the build phase.

from baseimage-docker.

FooBarWidget avatar FooBarWidget commented on May 31, 2024 10

As discussed in moby/moby#4032 and related discussions, setting ENV DEBIAN_FRONTEND noninteractive by default is a bad idea. What people really want is a way to set environment variables during 'docker build' without persisting them to the final container image. Unfortunately this is not something that we can fix, only the Docker guys can do this.

from baseimage-docker.

christianbundy avatar christianbundy commented on May 31, 2024 9

Why isn't ENV DEBIAN_FRONTEND noninteractive part of the default Dockerfile?

from baseimage-docker.

ishandutta2007 avatar ishandutta2007 commented on May 31, 2024 7

ENV DEBIAN_FRONTEND noninteractive didn't work for me
neither did ARG DEBIAN_FRONTEND noninteractive
but RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections did

from baseimage-docker.

Zandy avatar Zandy commented on May 31, 2024 6

in my case, after i change
RUN apt-get -y install redis-server
to
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install redis-server
in Dockerfile and rebuild it, information mentioned above no longer appears.
I hope it was useful for you.

from baseimage-docker.

hyperknot avatar hyperknot commented on May 31, 2024 6

I think the right choice is to set

ENV DEBIAN_FRONTEND noninteractive

At the beginning of each Dockerfile and set

ENV DEBIAN_FRONTEND teletype

At the end of each. noninteractive is needed for all the build steps, while teletype is needed for interactive configuration steps the user might want to do inside a running container.

from baseimage-docker.

dineshrathee12 avatar dineshrathee12 commented on May 31, 2024 6

EXAMPLE With Success:

echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
sudo apt-get install -y -q

It works fine for me.

from baseimage-docker.

famelis avatar famelis commented on May 31, 2024 4

@nikolay You are welcome!

Normaly debconf is installed to use frontend Dialog, which actually needs a cursor addressable terminal. Frontend Dialog needs the enviroment variable TERM set, in order to ask questions using a curses interface.
So when you ssh into a container and want to install something, you can select the Dialog frontend and set the TERM by export TERM=linux.

Now about the discussion here. I have some thoughts to share.

As it is better illustrated in debian bug 398707 by selecting the frontend to Noninteractive, one actually selects not to listen to the questions that are being asked by the package being installed.

This can be a good thing if one is sure that, all, usually configuration, questions eventually will have an answer. That is:

  • either debconf will have been pre-seeded with the answers for all questions that are asked
  • or the maintainer will supply all the needed, usually configuration, files with reasonable values.

So, Getting tons of debconf messages is not a bad thing. It, just, says that some things have to be configured, and all these things have to be done by the maintainer, usually in Dockerfile.

from baseimage-docker.

jjqq2013 avatar jjqq2013 commented on May 31, 2024 4

Although this is closed. I find when use sudo there need special attention.

NG: RUN sudo apt-get install -y xxxxxxx
OK: RUN sudo DEBIAN_FRONTEND=noninteractive apt-get install -y xxxxxxx

Good luck.

from baseimage-docker.

Chris-Hu avatar Chris-Hu commented on May 31, 2024 3

Set your variable in one command with the apt-get to keep the context

RUN export DEBIAN_FRONTEND=noninteractive && apt-get .....

from baseimage-docker.

jjqq2013 avatar jjqq2013 commented on May 31, 2024 3

hi guys, do not misunderstand me. I was not meaning to push an issue of this base image(i don't event know what it is),

i just wanted to appreciate you because your answer of "DEBIAN_FRONTEND =noninteractive" solved my problem,

and just wanted to contribute more comment about it when used in sudo (Whatever you think of sudo in docker container, there are some cases sudo being used)

That's all. Good luck.

from baseimage-docker.

Taisgeal avatar Taisgeal commented on May 31, 2024 3

I am brand new to Docker, but on an Ubuntu container I did
apt install dialog

and this warning message went away.

from baseimage-docker.

KeithTt avatar KeithTt commented on May 31, 2024 3

@famelis 👍

from baseimage-docker.

OnkelTem avatar OnkelTem commented on May 31, 2024 1

@jjqq2013 It's sort of off-topic, but why one would need to use sudos in... Dockerfile?

After reading all the discussion and some linked ones, I think the best thing to do is to IGNORE the warning messages. It's just one less thing we don't need to think about actually.

from baseimage-docker.

FooBarWidget avatar FooBarWidget commented on May 31, 2024

Where do you install packages? In your Dockerfile?

from baseimage-docker.

FooBarWidget avatar FooBarWidget commented on May 31, 2024

Then I don't know it either. You should ask a Debian forum.

from baseimage-docker.

nikolay avatar nikolay commented on May 31, 2024

@FooBarWidget It is a Ubuntu issue, as it seems. I added ENV TERM linux to silence most complaints. I think you can fix the issue in the base image to improve it. Vagrant had a similar issue (hashicorp/vagrant#1673), but they fixed it. Supposedly, the following fixes the issue:

sed -i 's/^mesg n$/tty -s \&\& mesg n/g' /root/.profile

from baseimage-docker.

nikolay avatar nikolay commented on May 31, 2024

@famelis Isn't this permanently turning off interactive mode? Should it be reverted at the end if you, for example, want interactive mode back on later for SSH, let's say? I'm sorry, I couldn't find in the man pages how exactly debconf-set-selections works. I've used it before, but didn't really bothered to find out.

from baseimage-docker.

nikolay avatar nikolay commented on May 31, 2024

@famelis I understand that. I was wondering if later I want to SSH into the instance and want to install something interactively - not something you should be doing anyway. Thanks for the tips!

from baseimage-docker.

brunowego avatar brunowego commented on May 31, 2024

@christianbundy 👍

from baseimage-docker.

HadesArchitect avatar HadesArchitect commented on May 31, 2024

The 'ENV DEBIAN_FRONTEND noninteractive' should be in the default Dockerfile or, at least, in the documentation, imho.

from baseimage-docker.

christianbundy avatar christianbundy commented on May 31, 2024

My PR (#252) was rejected, and I doubt that this will ever be resolved due to moby/moby#4032

from baseimage-docker.

christianbundy avatar christianbundy commented on May 31, 2024

@FooBarWidget Instead, could we set ENV DEBIAN_FRONTEND noninteractive at the start of the build, and reset it back to the default before running the final command?

from baseimage-docker.

FooBarWidget avatar FooBarWidget commented on May 31, 2024

I haven't tried but I think that would work.

from baseimage-docker.

ebuildy avatar ebuildy commented on May 31, 2024

Why this is not "embedded" in the base image already?

from baseimage-docker.

jjqq2013 avatar jjqq2013 commented on May 31, 2024

@OnkelTem this is a good question.

  1. The root user inside docker container could compromise the real host where docker is running, by some tricks. Theoretically, Docker, as a kernel-shared container technology, it is not and will never, be considered as the most secure isolation solution.

  2. There are some anti-root software which prevent itself from being run with root user. Such as yeoman.

from baseimage-docker.

hyperknot avatar hyperknot commented on May 31, 2024

from baseimage-docker.

OnkelTem avatar OnkelTem commented on May 31, 2024

@jjqq2013 totally agreed, but already answered by @hyperknot above - building is not running.
I personally use su (not sudo which is to be installed first, then configured sudoers - pain) for running processes inside container upon startup.

from baseimage-docker.

kamalverma04 avatar kamalverma04 commented on May 31, 2024

Just add the below line at the beginning of the Dockerfile to solve the issue.

ARG DEBIAN_FRONTEND=noninteractive

from baseimage-docker.

johnxy84 avatar johnxy84 commented on May 31, 2024

You could also add an ARG before running apt-get like so
ARG DEBIAN_FRONTEND=noninteractive

from baseimage-docker.

PikachuEXE avatar PikachuEXE commented on May 31, 2024

I just add DEBIAN_FRONTEND=noninteractive just after RUN with apt-get install

RUN \
  DEBIAN_FRONTEND=noninteractive; \
  apt-get update \
  && \
  apt-get install -y --no-install-recommends \
    build-essential \
    nodejs \
    git \
    curl \
    automake \
  && \
  apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

from baseimage-docker.

dsanpedro avatar dsanpedro commented on May 31, 2024

I use docker on Debian/Jessie.

In the Dockerfile of a container

FROM debian:sid

I set, before the first apt-get,

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

and everything is ok.

Thanks. This helped in an unrelated problem.

from baseimage-docker.

sanzenwin avatar sanzenwin commented on May 31, 2024

I use docker on Debian/Jessie.

In the Dockerfile of a container

FROM debian:sid

I set, before the first apt-get,

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

and everything is ok.

Helpful.

from baseimage-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.