summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"}