summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsunil.unnava <sunil.unnava@att.com>2019-04-09 01:21:36 -0400
committersunil.unnava <sunil.unnava@att.com>2019-04-09 01:21:52 -0400
commit3426c4842bca413d46c0e703876324f625210350 (patch)
tree6189f98d1a937a3c9565ba51404f9ce780bbe906
parentff8244a97ee52fb667c5dd78ae256b2d13795d98 (diff)
add userid to user
Issue-ID: DMAAP-1040 Change-Id: I00f651c8a9f1f87d7d1bf6999e52ed93bbf4383d Signed-off-by: sunil.unnava <sunil.unnava@att.com>
-rw-r--r--src/main/docker/Dockerfile13
-rw-r--r--src/main/docker/scripts/start-zookeeper.sh2
2 files changed, 9 insertions, 6 deletions
diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile
index 1140464..6dd0076 100644
--- a/src/main/docker/Dockerfile
+++ b/src/main/docker/Dockerfile
@@ -1,6 +1,7 @@
FROM ubuntu:16.04
-ENV ZK_DATA_DIR=/var/lib/zookeeper/data \
+ENV ZK_USER=mrzookeeper \
+ ZK_DATA_DIR=/var/lib/zookeeper/data \
ZK_LOG_DIR=/var/log/zookeeper \
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
@@ -51,9 +52,11 @@ RUN chmod -R 777 /opt/zookeeper/bin
ENTRYPOINT /opt/zookeeper/bin/start-zookeeper.sh
EXPOSE 2181 2888 3888
-RUN addgroup 2000 \
- && adduser 1000 -ingroup 2000 \
- && chown -R 1000:2000 /opt/$ZK_DIST/ /opt/zookeeper/ /var/lib/ /var/log/ /tmp/zookeeper/
+RUN useradd $ZK_USER \
+ && [ `id -u $ZK_USER` -eq 1000 ] \
+ && [ `id -g $ZK_USER` -eq 1000 ] \
+ && chown -R $ZK_USER:$ZK_USER /opt/$ZK_DIST/ /opt/zookeeper/ /var/lib/ /var/log/ /tmp/zookeeper/
+
+USER $ZK_USER
-USER 1000
diff --git a/src/main/docker/scripts/start-zookeeper.sh b/src/main/docker/scripts/start-zookeeper.sh
index 19ae316..446cbc4 100644
--- a/src/main/docker/scripts/start-zookeeper.sh
+++ b/src/main/docker/scripts/start-zookeeper.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
ZK_REPLICAS=${ZK_REPLICAS:-1}
-ZK_USER=${ZK_USER:-"1000"}
+ZK_USER=${ZK_USER:-"mrzookeeper"}
ZK_LOG_LEVEL=${ZK_LOG_LEVEL:-"INFO"}
ZK_DATA_DIR=${ZK_DATA_DIR:-"/var/lib/zookeeper/data"}
ZK_DATA_LOG_DIR=${ZK_DATA_LOG_DIR:-"/var/lib/zookeeper/data"}