Closed hongyi-zhao closed 4 years ago
It is possible to set this once at the beginning with
ENV DEBIAN_FRONTEND=noninteractive
This has the drawback that the variable is finally set in container, too.
There it can cause issues using interactive terminal commands that behave different if DEBIAN_FRONTEND
is set. For example, an application might skip [Yes|no]
questions.
So I decided to use instead:
'env DEBIAN_FRONTEND=noninteractive apt-get [...]'
This way the variable is set for this one command only.
If so, why not use it as following in the Dockerfile:
# set DEBIAN_FRONTEND
ENV DEBIAN_FRONTEND=noninteractive
# ... do stuff that needs the DEBIAN_FRONTEND during the build with apt-get.
# unset DEBIAN_FRONTEND
ENV DEBIAN_FRONTEND ""
#or
#ENV DEBIAN_FRONTEND ''
#or
#ENV DEBIAN_FRONTEND=
# unset DEBIAN_FRONTEND
ENV DEBIAN_FRONTEND ""
This does not unset the variable but sets it to an empty string. The variable itself remains.
docker would need an UNSET
instruction to really unset a variable.
I am not sure if or how behaviour for set but empty DEBIAN_FRONTEND
is defined.
Setting it only where needed is the cleanest way for sure.
docker would need an UNSET instruction to really unset a variable.
Do you mean I should write the instruction as shown below:
UNSET ENV DEBIAN_FRONTEND
I tried the above form and docker build will throw out the following error and terminate:
$ docker build --network host -f Dockerfiles/lion . -t deepin/lion
Sending build context to Docker daemon 35.84kB
Error response from daemon: Dockerfile parse error line 82: unknown instruction: UNSET
docker does not have an UNSET
instruction. That is why I set the variable for each command where it is needed.
I noticed that you used several times for the instrction 'env DEBIAN_FRONTEND=noninteractive' in your Dockerfile. I wonder why don't you only apply once of this command at the very beginning of the Dockerfile.