From 155958d04182c67cae44579de55ea4cc99bd9036 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 26 Nov 2018 17:00:59 -0800 Subject: [PATCH 1/2] Add "--no-overwrite-dir" to "tar" invocation for running as an arbitrary user This fixes "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" (which we get currently). --- docker-entrypoint.sh | 20 +++++++++++++++----- php5.6/apache/docker-entrypoint.sh | 20 +++++++++++++++----- php5.6/fpm-alpine/docker-entrypoint.sh | 20 +++++++++++++++----- php5.6/fpm/docker-entrypoint.sh | 20 +++++++++++++++----- php7.0/apache/docker-entrypoint.sh | 20 +++++++++++++++----- php7.0/fpm-alpine/docker-entrypoint.sh | 20 +++++++++++++++----- php7.0/fpm/docker-entrypoint.sh | 20 +++++++++++++++----- php7.1/apache/docker-entrypoint.sh | 20 +++++++++++++++----- php7.1/fpm-alpine/docker-entrypoint.sh | 20 +++++++++++++++----- php7.1/fpm/docker-entrypoint.sh | 20 +++++++++++++++----- php7.2/apache/docker-entrypoint.sh | 20 +++++++++++++++----- php7.2/fpm-alpine/docker-entrypoint.sh | 20 +++++++++++++++----- php7.2/fpm/docker-entrypoint.sh | 20 +++++++++++++++----- 13 files changed, 195 insertions(+), 65 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php5.6/apache/docker-entrypoint.sh b/php5.6/apache/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php5.6/apache/docker-entrypoint.sh +++ b/php5.6/apache/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php5.6/fpm-alpine/docker-entrypoint.sh b/php5.6/fpm-alpine/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php5.6/fpm-alpine/docker-entrypoint.sh +++ b/php5.6/fpm-alpine/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php5.6/fpm/docker-entrypoint.sh b/php5.6/fpm/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php5.6/fpm/docker-entrypoint.sh +++ b/php5.6/fpm/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php7.0/apache/docker-entrypoint.sh b/php7.0/apache/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php7.0/apache/docker-entrypoint.sh +++ b/php7.0/apache/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php7.0/fpm-alpine/docker-entrypoint.sh b/php7.0/fpm-alpine/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php7.0/fpm-alpine/docker-entrypoint.sh +++ b/php7.0/fpm-alpine/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php7.0/fpm/docker-entrypoint.sh b/php7.0/fpm/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php7.0/fpm/docker-entrypoint.sh +++ b/php7.0/fpm/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php7.1/apache/docker-entrypoint.sh b/php7.1/apache/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php7.1/apache/docker-entrypoint.sh +++ b/php7.1/apache/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php7.1/fpm-alpine/docker-entrypoint.sh b/php7.1/fpm-alpine/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php7.1/fpm-alpine/docker-entrypoint.sh +++ b/php7.1/fpm-alpine/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php7.1/fpm/docker-entrypoint.sh b/php7.1/fpm/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php7.1/fpm/docker-entrypoint.sh +++ b/php7.1/fpm/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php7.2/apache/docker-entrypoint.sh b/php7.2/apache/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php7.2/apache/docker-entrypoint.sh +++ b/php7.2/apache/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php7.2/fpm-alpine/docker-entrypoint.sh b/php7.2/fpm-alpine/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php7.2/fpm-alpine/docker-entrypoint.sh +++ b/php7.2/fpm-alpine/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image diff --git a/php7.2/fpm/docker-entrypoint.sh b/php7.2/fpm/docker-entrypoint.sh index c6da58468e..20bb653ee9 100755 --- a/php7.2/fpm/docker-entrypoint.sh +++ b/php7.2/fpm/docker-entrypoint.sh @@ -45,11 +45,21 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ -n "$(ls -A)" ]; then echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" fi - tar --create \ - --file - \ - --directory /usr/src/wordpress \ - --owner "$user" --group "$group" \ - . | tar --extract --file - + sourceTarArgs=( + --create + --file - + --directory /usr/src/wordpress + --owner "$user" --group "$group" + ) + targetTarArgs=( + --extract + --file - + ) + if [ "$user" != '0' ]; then + # avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" + targetTarArgs+=( --no-overwrite-dir ) + fi + tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" echo >&2 "Complete! WordPress has been successfully copied to $PWD" if [ ! -e .htaccess ]; then # NOTE: The "Indexes" option is disabled in the php:apache base image From 5bad0cb022513fc9bb3bbc72c62db2bac0f5e84a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 26 Nov 2018 17:06:23 -0800 Subject: [PATCH 2/2] Add '#1000' syntax fix too --- docker-entrypoint.sh | 5 +++++ php5.6/apache/docker-entrypoint.sh | 5 +++++ php5.6/fpm-alpine/docker-entrypoint.sh | 5 +++++ php5.6/fpm/docker-entrypoint.sh | 5 +++++ php7.0/apache/docker-entrypoint.sh | 5 +++++ php7.0/fpm-alpine/docker-entrypoint.sh | 5 +++++ php7.0/fpm/docker-entrypoint.sh | 5 +++++ php7.1/apache/docker-entrypoint.sh | 5 +++++ php7.1/fpm-alpine/docker-entrypoint.sh | 5 +++++ php7.1/fpm/docker-entrypoint.sh | 5 +++++ php7.2/apache/docker-entrypoint.sh | 5 +++++ php7.2/fpm-alpine/docker-entrypoint.sh | 5 +++++ php7.2/fpm/docker-entrypoint.sh | 5 +++++ 13 files changed, 65 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php5.6/apache/docker-entrypoint.sh b/php5.6/apache/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php5.6/apache/docker-entrypoint.sh +++ b/php5.6/apache/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php5.6/fpm-alpine/docker-entrypoint.sh b/php5.6/fpm-alpine/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php5.6/fpm-alpine/docker-entrypoint.sh +++ b/php5.6/fpm-alpine/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php5.6/fpm/docker-entrypoint.sh b/php5.6/fpm/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php5.6/fpm/docker-entrypoint.sh +++ b/php5.6/fpm/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php7.0/apache/docker-entrypoint.sh b/php7.0/apache/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php7.0/apache/docker-entrypoint.sh +++ b/php7.0/apache/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php7.0/fpm-alpine/docker-entrypoint.sh b/php7.0/fpm-alpine/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php7.0/fpm-alpine/docker-entrypoint.sh +++ b/php7.0/fpm-alpine/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php7.0/fpm/docker-entrypoint.sh b/php7.0/fpm/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php7.0/fpm/docker-entrypoint.sh +++ b/php7.0/fpm/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php7.1/apache/docker-entrypoint.sh b/php7.1/apache/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php7.1/apache/docker-entrypoint.sh +++ b/php7.1/apache/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php7.1/fpm-alpine/docker-entrypoint.sh b/php7.1/fpm-alpine/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php7.1/fpm-alpine/docker-entrypoint.sh +++ b/php7.1/fpm-alpine/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php7.1/fpm/docker-entrypoint.sh b/php7.1/fpm/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php7.1/fpm/docker-entrypoint.sh +++ b/php7.1/fpm/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php7.2/apache/docker-entrypoint.sh b/php7.2/apache/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php7.2/apache/docker-entrypoint.sh +++ b/php7.2/apache/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php7.2/fpm-alpine/docker-entrypoint.sh b/php7.2/fpm-alpine/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php7.2/fpm-alpine/docker-entrypoint.sh +++ b/php7.2/fpm-alpine/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data' diff --git a/php7.2/fpm/docker-entrypoint.sh b/php7.2/fpm/docker-entrypoint.sh index 20bb653ee9..0d37f1d7b8 100755 --- a/php7.2/fpm/docker-entrypoint.sh +++ b/php7.2/fpm/docker-entrypoint.sh @@ -29,6 +29,11 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then apache2*) user="${APACHE_RUN_USER:-www-data}" group="${APACHE_RUN_GROUP:-www-data}" + + # strip off any '#' symbol ('#1000' is valid syntax for Apache) + pound='#' + user="${user#$pound}" + group="${group#$pound}" ;; *) # php-fpm user='www-data'