Created
March 23, 2023 13:25
-
-
Save AntoniosHadji/dfbacb813584a52f7dc52740f040633f to your computer and use it in GitHub Desktop.
Dockerfile create and use non-root user inside container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG UNAME=antonios | |
ARG UID=1000 | |
ARG GID=1000 | |
RUN groupadd -g $GID -o $UNAME | |
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME | |
RUN usermod -aG sudo $UNAME | |
USER $UNAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change UNAME arg, and use this to have container default user be not root.