Last active
October 2, 2023 10:49
-
-
Save roman4ello/4ba42a2a8bb160f2ca9ca74cacb2beea to your computer and use it in GitHub Desktop.
Create user in Dockerfile
This file contains hidden or 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
FROM amazoncorretto:8u382-alpine-jre | |
ARG USER_ID=YOUR_USER_ID | |
ARG GROUP_ID=YOUR_GROUP_ID | |
ARG USER_NAME=YOUR_USER | |
ARG GROUP_NAME=YOUR_GROUP | |
RUN set -x && addgroup -g $GROUP_ID $GROUP_NAME && \ | |
adduser --shell /sbin/nologin \ | |
--disabled-password \ | |
--gecos '' \ | |
--no-create-home \ | |
--uid $USER_ID \ | |
--ingroup $GROUP_NAME \ | |
$USER_NAME && set +x | |
USER $USER_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment