1

I am making a Dockerfile and want to install xfce4. This is what I am currently trying:

RUN /bin/bash -c 'echo y 12 4 2 | apt install xfce4'

During installation, I am first prompted by a yes or no for installation. Then, I am prompted to give my geographical location (for some reason) and my timezone. Additionally, I am prompted to choose between gdm3 and lightdm. I am trying to pass these choices by echoing my choices and piping the output into stdin. This works for the yes or no, but fails for the rest. Any ideas on how to do this? Thanks.

ceving
  • 21,900
  • 13
  • 104
  • 178
  • Look into `expect` – Shawn Jan 24 '22 at 07:13
  • `apt` is for interactive use. Use `apt-get` in scripts: `apt-get install -y ...` See here: https://unix.stackexchange.com/questions/314279/stop-interactive-prompts-from-apt-get – ceving Jan 24 '22 at 07:52

1 Answers1

0

Use:

DEBIAN_FRONTEND=noninteractive apt-get install -y xfce4

to install something non-interactively.

KamilCuk
  • 120,984
  • 8
  • 59
  • 111