# Create user 'user' and add them to 'sudo' for sudo access and set # the passwd to 'user' FROM xe-base-stage AS xe-user-stage RUN apt-get -q update \ && DEBIAN_FRONTEND=noninteractive \ && apt-get install --no-install-recommends -y \ sudo ARG USER_UID=1000 ARG USER_GID=1000 RUN echo "Creating 'user': $USER_UID:$USER_GID" # NOTE: Requires 'sudo' package to already be installed RUN groupadd -g $USER_GID user \ && useradd --no-log-init \ -s /bin/bash \ -m \ -u $USER_UID \ -g user \ -G sudo,video \ -p $(echo "user" | openssl passwd -stdin) user # Set 'sudo' to NOPASSWD for all container users RUN sed -i -e 's,%sudo.*,%sudo ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers RUN apt-get clean \ && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}