I have a docker image that I use to test install scripts in a CI setup.
The install scripts are meant to be run by non-root users so the commands in the scripts use sudo
quite often.
I added the following which allows me to avoid password prompts while running sudo commands.
RUN adduser --disabled-password --gecos '' user
RUN adduser user sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER user
However, this doesn't work with sudo validate (sudo -v
). No matter what I try, sudo -v
will always ask for a password.
I don't want to remove sudo -v
from the install scripts.
Anyone know why this is? I tried on both ubuntu:16.04
and ubuntu:18.04
docker images.