While creating image using Dockerfile, you may want to install some package or dependency software on it. Some of these packages requires confirmation inputs as YES / No to continue the installation.
The command “docker build” may fail with errors like-
Do you want to continue? [Y/n] Abort. The command ‘/bin/sh -c apt-get install ……’ returned a non-zero code: 1
To avoid this error, one of the solution suggested is to set ENV variable in Dockerfile
But Docker site discourages to use this in Dockerfiles. It may have side effects. The
DEBIAN_FRONTEND environment variable is inherited by all images and containers built from your image, effectively changing their behavior. People using those images run into problems when installing software interactively, because installers do not show any dialog boxes. Fro more details check here.
Instead you can use –yes or -y in the install command. Say, the command is
RUN apt-get install nodejs
then just add -y to it
RUN apt-get install -y nodejs
This way it will install without waiting for the prompt.