From 9afb5dca0efb9d5b0e394ee8d7fe6dfc048a8bea Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 28 Feb 2018 05:35:33 +0100 Subject: Create /home/csa and register uid --- Dockerfile | 8 ++++++-- docker-entrypoint.sh | 12 ++++++++++++ sx.sh | 9 +++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100755 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index fd6da46..01fc4f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,10 +18,14 @@ RUN yum -y install \ kubernetes-client \ && yum clean all - - COPY sx.sh /bin/sx RUN chmod 775 /bin/sx +# For ugly applications which want to resolve user name +RUN chmod g=u /etc/passwd + +COPY docker-entrypoint.sh / +ENTRYPOINT ["/docker-entrypoint.sh"] + CMD [ "/bin/sx" ] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..f4d9f20 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,12 @@ +#! /bin/bash + +set -e + +if ! whoami &> /dev/null; then + if [ -w /etc/passwd ]; then + echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd + fi +fi + +echo "Running: $@" +exec "$@" diff --git a/sx.sh b/sx.sh index 71e3a35..eda67b7 100644 --- a/sx.sh +++ b/sx.sh @@ -8,6 +8,7 @@ function display_container_header { echo "| OS : $(