To avoid the interactive questions by adduser, you can call it with these parameters:
RUN adduser --disabled-password --gecos '' newuser
The --gecos
parameter is used to set the additional information. In this case it is just empty.
On systems with busybox (like Alpine), use
RUN adduser -D -g '' newuser
See busybox adduser