Skip to content

Instantly share code, notes, and snippets.

@utkuozdemir
Last active October 11, 2023 19:47
Show Gist options
  • Save utkuozdemir/3380c32dfee472d35b9c3e39bc72ff01 to your computer and use it in GitHub Desktop.
Save utkuozdemir/3380c32dfee472d35b9c3e39bc72ff01 to your computer and use it in GitHub Desktop.
A gist to add a user to the Alpine docker image
FROM alpine:3
ENV USER_ID=65535
ENV GROUP_ID=65535
ENV USER_NAME=rsync-user
ENV GROUP_NAME=rsync-user
RUN addgroup -g $GROUP_ID $GROUP_NAME && \
adduser --shell /sbin/nologin --disabled-password \
--no-create-home --uid $USER_ID --ingroup $GROUP_NAME $USER_NAME
USER $USER_NAME
@utkuozdemir
Copy link
Author

At line 8, shouldn't it be:

RUN addgroup -g $GROUP_ID $GROUP_NAME && \

instead of

RUN addgroup -g $USER_ID $GROUP_NAME && \

Thanks, you are right, I updated it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment