From 2e2c93b2b165016945aa85427d6a64574b1a8a5c Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Mon, 26 Jul 2021 01:36:41 -0600 Subject: [PATCH] feature(helpers): change docker run cmd - add user specification so UID/GID always specified - add container default values --- helpers/ab-nginx.params.template | 7 ++++--- helpers/ab-nginx.sh | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/helpers/ab-nginx.params.template b/helpers/ab-nginx.params.template index 060ee58..d661b29 100644 --- a/helpers/ab-nginx.params.template +++ b/helpers/ab-nginx.params.template @@ -17,10 +17,11 @@ # ensure the container can read and/or write to locations on the host or # has access to files shared between members of a container stack. # REQUIRED: NO -# DEFAULT: UID=8080, GID=8080 +# DEFAULT: NGINX_UID=8080, NGINX_GID=8080 # VALID OPTIONS: any permissible and available UID/GID value -#UID=8080 -#GID=8080 +#NGINX_UID=8080 +#NGINX_GID=8080 + # # Network options diff --git a/helpers/ab-nginx.sh b/helpers/ab-nginx.sh index 63b1985..f4dab7d 100644 --- a/helpers/ab-nginx.sh +++ b/helpers/ab-nginx.sh @@ -218,6 +218,7 @@ if [ -z "$SSL_CERT" ]; then # shellcheck disable=SC2086 docker run --rm -it --name "${container_name}" \ --env-file ab-nginx.params \ + --user="${NGINX_UID:-8080}:${NGINX_GID:-8080}" \ -e SERVER_NAMES="$HOSTNAMES" \ $vmount \ --network=${NETWORK} \ @@ -229,6 +230,7 @@ if [ -z "$SSL_CERT" ]; then # shellcheck disable=SC2086 docker run -d --name "${container_name}" \ --env-file ab-nginx.params \ + --user="${NGINX_UID:-8080}:${NGINX_GID:-8080}" \ -e SERVER_NAMES="$HOSTNAMES" \ $vmount \ --network=${NETWORK} \ @@ -247,6 +249,7 @@ else # shellcheck disable=SC2086 docker run --rm -it --name "${container_name}" \ --env-file ab-nginx.params \ + --user="${NGINX_UID:-8080}:${NGINX_GID:-8080}" \ -e SERVER_NAMES="$HOSTNAMES" \ $vmount \ --network=${NETWORK} \ @@ -264,6 +267,7 @@ else # shellcheck disable=SC2086 docker run -d --name "${container_name}" \ --env-file ab-nginx.params \ + --user="${NGINX_UID:-8080}:${NGINX_GID:-8080}" \ -e SERVER_NAMES="$HOSTNAMES" \ $vmount \ --network=${NETWORK} \