Adding not root user to Docker container
Adding not root user to Docker container in docker file: ARG USERNAME=containeruser ARG USER_UID=1000 ARG USER_GID=$USER_UID RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ && chown -R $USER_UID:$USER_GID /home/$USERNAME # [Optional] Add sudo support if needed # && apt-get update && apt-get install -y sudo \ # && echo $USERNAME ALL=(root) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ # && chmod 0440 /etc/sudoers.d/$USERNAME # Set the default user for all processes in the container (optional, but ensures everything runs as this user) # USER $USERNAME