Comments (41)
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.
Not a baseimage-docker issue. You need to set DEBIAN_FRONTEND to noninteractive.
from baseimage-docker.
@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.
@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.
ENV DEBIAN_FRONTEND noninteractive
worked as well to me!
from baseimage-docker.
@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.
👍 for ENV DEBIAN_FRONTEND noninteractive
from baseimage-docker.
This worked for me:
ENV DEBIAN_FRONTEND noninteractive
from baseimage-docker.
Using ARG
instead of ENV
would set the variable just for the build phase.
from baseimage-docker.
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.
Why isn't ENV DEBIAN_FRONTEND noninteractive
part of the default Dockerfile?
from baseimage-docker.
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.
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.
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.
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.
@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.
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.
Set your variable in one command with the apt-get to keep the context
RUN export DEBIAN_FRONTEND=noninteractive && apt-get .....
from baseimage-docker.
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.
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.
@famelis 👍
from baseimage-docker.
@jjqq2013 It's sort of off-topic, but why one would need to use sudo
s 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.
Where do you install packages? In your Dockerfile?
from baseimage-docker.
Then I don't know it either. You should ask a Debian forum.
from baseimage-docker.
@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.
@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.
@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.
from baseimage-docker.
The 'ENV DEBIAN_FRONTEND noninteractive' should be in the default Dockerfile or, at least, in the documentation, imho.
from baseimage-docker.
My PR (#252) was rejected, and I doubt that this will ever be resolved due to moby/moby#4032
from baseimage-docker.
@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.
I haven't tried but I think that would work.
from baseimage-docker.
Why this is not "embedded" in the base image already?
from baseimage-docker.
@OnkelTem this is a good question.
-
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.
-
There are some anti-root software which prevent itself from being run with root user. Such as yeoman.
from baseimage-docker.
from baseimage-docker.
@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.
Just add the below line at the beginning of the Dockerfile to solve the issue.
ARG DEBIAN_FRONTEND=noninteractive
from baseimage-docker.
You could also add an ARG before running apt-get like so
ARG DEBIAN_FRONTEND=noninteractive
from baseimage-docker.
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.
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-selectionsand everything is ok.
Thanks. This helped in an unrelated problem.
from baseimage-docker.
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-selectionsand everything is ok.
Helpful.
from baseimage-docker.
Related Issues (20)
- You should probably simply the docs to show the memcached example very early on HOT 3
- We now have a Discord server!
- Changelog for `focal-1.1.0` HOT 3
- hi. rocky8 or centos8 not support? HOT 3
- Change container builder from Docker to Buildah/Podman HOT 5
- There is a missing tag for focal-1.1.0 HOT 5
- pull error HOT 3
- Is the version of 0.10.2 alreadly outdated..? HOT 2
- apt does not work HOT 7
- syslog-ng warning HOT 2
- User inside the container HOT 9
- Timezone change HOT 2
- The docker pull command on the hub.docker.com page doesn't work HOT 1
- Security vulnerabilities HOT 6
- Docker Hub and Free Team Organisations HOT 1
- Base on Ubuntu 22.04 LTS? HOT 1
- Where did the MASTER tag go?
- package architecture (amd64) does not match system (arm64) on Macbook M2 HOT 1
- how to enable sshd in baseimage? HOT 2
- Status of jammy-1.0.2 build HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from baseimage-docker.