Skip to content

Instantly share code, notes, and snippets.

@PanjiNamjaElf
Forked from briceburg/Dockerfile.fails
Created October 20, 2022 15:01
Show Gist options
  • Save PanjiNamjaElf/8b3fd988d3c31e9e89bd1152a480b428 to your computer and use it in GitHub Desktop.
Save PanjiNamjaElf/8b3fd988d3c31e9e89bd1152a480b428 to your computer and use it in GitHub Desktop.
docker - example adding www-data user to alpine images
FROM nginx:alpine
# stock verison from php:alpine image
# ensure www-data user exists
RUN set -x \
&& addgroup -g 82 -S www-data \
&& adduser -u 82 -D -S -G www-data www-data
# 82 is the standard uid/gid for "www-data" in Alpine
# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2
# http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2
# http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2
FROM nginx:alpine
# modified version from php:alpine image
# ensure www-data user exists
RUN set -x ; \
addgroup -g 82 -S www-data ; \
adduser -u 82 -D -S -G www-data www-data && exit 0 ; exit 1
# 82 is the standard uid/gid for "www-data" in Alpine
# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2
# http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2
# http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment