From a97f0743a91b482003c26d356690a8c3fb33720e Mon Sep 17 00:00:00 2001 From: Ricardo Martinelli de Oliveira Date: Wed, 14 Mar 2018 12:38:26 -0300 Subject: [PATCH 1/2] [SPARK-23680] Fix entrypoint.sh to properly support Arbitrary UIDs --- .../docker/src/main/dockerfiles/spark/entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh b/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh index 3d67b0a702dd..cf50c422e91f 100755 --- a/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh +++ b/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh @@ -17,13 +17,15 @@ # # echo commands to the terminal output -set -ex +set -x # Check whether there is a passwd entry for the container UID myuid=$(id -u) mygid=$(id -g) uidentry=$(getent passwd $myuid) +set -e + # If there is no passwd entry for the container UID, attempt to create one if [ -z "$uidentry" ] ; then if [ -w /etc/passwd ] ; then From d6f54463f721a3cd36ff8ecceb5975ce1c4bcdfd Mon Sep 17 00:00:00 2001 From: Ricardo Martinelli de Oliveira Date: Wed, 14 Mar 2018 14:07:12 -0300 Subject: [PATCH 2/2] Follow suggestions in the PR Fixes SPARK-23680 --- .../docker/src/main/dockerfiles/spark/entrypoint.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh b/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh index cf50c422e91f..d0cf284f035e 100755 --- a/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh +++ b/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh @@ -17,13 +17,14 @@ # # echo commands to the terminal output -set -x +set -ex # Check whether there is a passwd entry for the container UID myuid=$(id -u) mygid=$(id -g) +# turn off -e for getent because it will return error code in anonymous uid case +set +e uidentry=$(getent passwd $myuid) - set -e # If there is no passwd entry for the container UID, attempt to create one