Search code examples
dockerdocker-composeapache-nifiapache-nifi-registry

NiFi Registry Access Denied


I am trying to dockerise the 3 services Zookeeper, NiFi and NiFi Registry below is the docker-compose.yml file

version: "3.7"
services:
    # configuration manager for NiFi
    zookeeper:
        hostname: myzookeeper
        container_name: zookeeper_container_persistent
        image: zookeeper:latest  
        restart: on-failure
        environment:
            - ALLOW_ANONYMOUS_LOGIN=no
        networks:
            - my_persistent_network
# version control for nifi flows
    registry:
        build:
            context: .
        user: nifi
        hostname: myregistry
        container_name: registry_container_persistent
        image: apache/nifi-registry:latest 
        restart: on-failure
        ports:
            - "18080:18080"
        environment:
            - LOG_LEVEL=INFO
            - NIFI_REGISTRY_DB_DIR=/opt/nifi-registry/nifi-registry-current/database
            - NIFI_REGISTRY_FLOW_PROVIDER=file
            - NIFI_REGISTRY_FLOW_STORAGE_DIR=/opt/nifi-registry/nifi-registry-current/flow_storage
        volumes:
            - nifi_registry_database:/opt/nifi-registry/nifi-registry-current/database
            - nifi_registry_flow_storage:/opt/nifi-registry/nifi-registry-current/flow_storage
        networks:
            - my_persistent_network
    nifi:
        build:
            context: .
        user: nifi
        hostname: mynifi
        container_name: nifi_container_persistent
        image: apache/nifi:latest
        restart: on-failure
        ports:
            - '8091:8080'
        environment:
            - NIFI_WEB_HTTP_PORT=8080
            - NIFI_CLUSTER_IS_NODE=true
            - SINGLE_USER_CREDENTIALS_USERNAME=admin
            - SINGLE_USER_CREDENTIALS_PASSWORD=ctsBtRBKHRAx69EqUghvvgEvjnaLjFEB
            - NIFI_CLUSTER_NODE_PROTOCOL_PORT=8082
            - NIFI_ZK_CONNECT_STRING=myzookeeper:2181
            - NIFI_ELECTION_MAX_WAIT=30 sec
            - NIFI_SENSITIVE_PROPS_KEY='12345678901234567890A'
        # healthcheck:
        #     test: "${DOCKER_HEALTHCHECK_TEST:-curl localhost:8091/nifi/}"
        #     interval: "60s"
        #     timeout: "3s"
        #     start_period: "5s"
        #     retries: 5
        volumes:
            - nifi_database_repository:/opt/nifi/nifi-current/database_repository
            - nifi_flowfile_repository:/opt/nifi/nifi-current/flowfile_repository
            - nifi_content_repository:/opt/nifi/nifi-current/content_repository
            - nifi_provenance_repository:/opt/nifi/nifi-current/provenance_repository
            - nifi_state:/opt/nifi/nifi-current/state
            - nifi_logs:/opt/nifi/nifi-current/logs
            - nifi_conf:/opt/nifi/nifi-current/conf
        networks:
            - my_persistent_network
networks:
  my_persistent_network:


volumes:
  nifi_conf: {external: true}
  nifi_database_repository: {external: true}
  nifi_flowfile_repository: {external: true}
  nifi_content_repository: {external: true}
  nifi_provenance_repository: {external: true}
  nifi_state: {external: true}
  nifi_logs: {external: true}
  nifi_registry_database: {external: true}
  nifi_registry_flow_storage: {external: true}
  # nifi_database_repository:
  #   external: true

while running docker stack deploy -c docker-compose.local.yml nifi_docker the NiFi Registry is not running and its getting exited. The error that is thrown is

Caused by: org.h2.mvstore.MVStoreException: Could not open file /opt/nifi-registry/nifi-registry-current/database/nifi-registry-primary.mv.db 

Log File

I have also tried to specify the user tag also within the docker compose file not sure what is causing the issue.

When I change the following lines from

volumes:
            - nifi_registry_database:/opt/nifi-registry/nifi-registry-current/database
            - nifi_registry_flow_storage:/opt/nifi-registry/nifi-registry-current/flow_storage

to

volumes:
            - ./nifi_registry_database:/opt/nifi-registry/nifi-registry-current/database
            - ./nifi_registry_flow_storage:/opt/nifi-registry/nifi-registry-current/flow_storage

the registry seems to be up all the time but this would be creating the volumes locally, I want to be able to deploy the stack via GitLab on a Docker Server.


Solution

  • adding user: root to the docker-compose file will solve the issue.