Skip to content

Instantly share code, notes, and snippets.

@zhooravell
Created June 22, 2021 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhooravell/c7a4acc88e72b325647c1bb775087fd8 to your computer and use it in GitHub Desktop.
Save zhooravell/c7a4acc88e72b325647c1bb775087fd8 to your computer and use it in GitHub Desktop.
Change user in dockerized alpine
version: "3.7"
services:
alpine:
build:
context: ${PATH_TO_DOCKERFILE}
args:
UID: 1002
GID: 1002
FROM alpine
ARG UID=1000
ARG GID=1000
ENV UID=${UID}
ENV GID=${GID}
RUN apk update && apk upgrade \
&& apk add --no-cache shadow \
&& usermod -u $UID www-data && groupmod -g $GID www-data \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment