There are ways to automatically answer -y in bash commands for example like
RUN apt-get install -y nodejs
but I'm having this case I want to run
dpkg --install someDebianpackage.deb && apt install --assume-yes --fix-broken
It actually answers y for the immediate prompt given by it but in the later stage it asks me to configure geographic are with answer 6
and after that again I want to answer the command with 20 for the city corresponding to timezone
and then again with answer 31 and then 1 as same as above for different questions.
What I want to know is to run this command as single command in a non-interactive way. ( I'm hoping to make a docker file and put the above command along with some other commands that can be chained with &&
in a RUN Command for example like
RUN apt-get update && apt-get install sudo && "the above command along with their answers" && "some other command"
I would highly appreciate some guidance over this
Technically, you can auto-answer prompts with a tool like expect. However, that's usually much more difficult than getting the program to stop asking you questions.
I'm not sure why apt is asking for your timezone, but I suspect that you're pulling in the tzdata package somehow, which wants to configure your timezone. To avoid these questions, you should set the frontend to non-interactive:
To run
dpkg
(behind other tools like Apt) without interactive dialogue, you can set one environment variable asDEBIAN_FRONTEND=noninteractive
(Source.)
In a Dockerfile, you can set an environment variable like this:
ENV DEBIAN_FRONTEND=noninteractive
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With