diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/docker/Dockerfile | 12 | ||||
-rw-r--r-- | src/main/docker/scripts/start-zookeeper.sh | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile index 3e0652e..6dd0076 100644 --- a/src/main/docker/Dockerfile +++ b/src/main/docker/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:16.04 -ENV ZK_USER=root \ +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 @@ -43,7 +43,6 @@ COPY scripts /opt/zookeeper/bin/ # for necessary directories and symlink the distribution as a user executable RUN set -x \ && mkdir -p $ZK_DATA_DIR $ZK_LOG_DIR /usr/share/zookeeper /tmp/zookeeper /usr/etc/ \ - && chown -R "$ZK_USER:$ZK_USER" /opt/$ZK_DIST $ZK_DATA_DIR $ZK_LOG_DIR /tmp/zookeeper \ && ln -s /opt/zookeeper/conf/ /usr/etc/zookeeper \ && ln -s /opt/zookeeper/bin/* /usr/bin \ && ln -s /opt/zookeeper/$ZK_DIST.jar /usr/share/zookeeper/ \ @@ -52,3 +51,12 @@ RUN set -x \ RUN chmod -R 777 /opt/zookeeper/bin ENTRYPOINT /opt/zookeeper/bin/start-zookeeper.sh EXPOSE 2181 2888 3888 + +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 + + diff --git a/src/main/docker/scripts/start-zookeeper.sh b/src/main/docker/scripts/start-zookeeper.sh index e2f3f09..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:-"root"} +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"} |