From 56dfcc2cd60e751d163d8bc403846c37f7dee4b9 Mon Sep 17 00:00:00 2001 From: pepov Date: Wed, 18 Jul 2018 10:46:09 +0200 Subject: [PATCH] NIFI-5438 create all volume directories for chowning properly, then create proper volumes for persistence. Notes: create conf instead of conf/templates since it will be created automatically. Create database_repository instead of data, since that is the default configuration. Create state volume used to store local state by default. This closes #2905. Signed-off-by: Aldrin Piri --- nifi-docker/dockerhub/Dockerfile | 21 +++++++++++++++------ nifi-docker/dockermaven/Dockerfile | 21 +++++++++++++++------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/nifi-docker/dockerhub/Dockerfile b/nifi-docker/dockerhub/Dockerfile index 4059a9fad3..cf932cffef 100644 --- a/nifi-docker/dockerhub/Dockerfile +++ b/nifi-docker/dockerhub/Dockerfile @@ -36,12 +36,13 @@ ADD sh/ ${NIFI_BASE_DIR}/scripts/ # Setup NiFi user and create necessary directories RUN groupadd -g ${GID} nifi || groupmod -n nifi `getent group ${GID} | cut -d: -f1` \ && useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \ - && mkdir -p ${NIFI_HOME}/conf/templates \ - && mkdir -p $NIFI_BASE_DIR/data \ - && mkdir -p $NIFI_BASE_DIR/flowfile_repository \ - && mkdir -p $NIFI_BASE_DIR/content_repository \ - && mkdir -p $NIFI_BASE_DIR/provenance_repository \ - && mkdir -p $NIFI_LOG_DIR \ + && mkdir -p ${NIFI_HOME}/conf \ + && mkdir -p ${NIFI_HOME}/database_repository \ + && mkdir -p ${NIFI_HOME}/flowfile_repository \ + && mkdir -p ${NIFI_HOME}/content_repository \ + && mkdir -p ${NIFI_HOME}/provenance_repository \ + && mkdir -p ${NIFI_HOME}/state \ + && mkdir -p ${NIFI_LOG_DIR} \ && chown -R nifi:nifi ${NIFI_BASE_DIR} \ && apt-get update \ && apt-get install -y jq xmlstarlet procps @@ -54,6 +55,14 @@ RUN curl -fSL ${MIRROR}/${NIFI_BINARY_URL} -o ${NIFI_BASE_DIR}/nifi-${NIFI_VERSI && tar -xvzf ${NIFI_BASE_DIR}/nifi-${NIFI_VERSION}-bin.tar.gz -C ${NIFI_BASE_DIR} \ && rm ${NIFI_BASE_DIR}/nifi-${NIFI_VERSION}-bin.tar.gz +VOLUME ${NIFI_LOG_DIR} \ + ${NIFI_HOME}/conf \ + ${NIFI_HOME}/database_repository \ + ${NIFI_HOME}/flowfile_repository \ + ${NIFI_HOME}/content_repository \ + ${NIFI_HOME}/provenance_repository \ + ${NIFI_HOME}/state + # Clear nifi-env.sh in favour of configuring all environment variables in the Dockerfile RUN echo "#!/bin/sh\n" > $NIFI_HOME/bin/nifi-env.sh diff --git a/nifi-docker/dockermaven/Dockerfile b/nifi-docker/dockermaven/Dockerfile index 19d14a95d9..a4bfce75ca 100644 --- a/nifi-docker/dockermaven/Dockerfile +++ b/nifi-docker/dockermaven/Dockerfile @@ -36,16 +36,25 @@ ADD $NIFI_BINARY $NIFI_BASE_DIR # Setup NiFi user and create necessary directories RUN groupadd -g ${GID} nifi || groupmod -n nifi `getent group ${GID} | cut -d: -f1` \ && useradd --shell /bin/bash -u ${UID} -g ${GID} -m nifi \ - && mkdir -p ${NIFI_HOME}/conf/templates \ - && mkdir -p $NIFI_BASE_DIR/data \ - && mkdir -p $NIFI_BASE_DIR/flowfile_repository \ - && mkdir -p $NIFI_BASE_DIR/content_repository \ - && mkdir -p $NIFI_BASE_DIR/provenance_repository \ - && mkdir -p $NIFI_LOG_DIR \ + && mkdir -p ${NIFI_HOME}/conf \ + && mkdir -p ${NIFI_HOME}/database_repository \ + && mkdir -p ${NIFI_HOME}/flowfile_repository \ + && mkdir -p ${NIFI_HOME}/content_repository \ + && mkdir -p ${NIFI_HOME}/provenance_repository \ + && mkdir -p ${NIFI_HOME}/state \ + && mkdir -p ${NIFI_LOG_DIR} \ && chown -R nifi:nifi ${NIFI_BASE_DIR} \ && apt-get update \ && apt-get install -y jq xmlstarlet procps +VOLUME ${NIFI_LOG_DIR} \ + ${NIFI_HOME}/conf \ + ${NIFI_HOME}/database_repository \ + ${NIFI_HOME}/flowfile_repository \ + ${NIFI_HOME}/content_repository \ + ${NIFI_HOME}/provenance_repository \ + ${NIFI_HOME}/state + USER nifi # Clear nifi-env.sh in favour of configuring all environment variables in the Dockerfile