3nomis
3nomis

Reputation: 1613

Persist apache nifi flow.xml.gz file in docker volume

How can I persist the flow.xml.gz file in nifi docker container?
I am using a docker-compose file, it is giving me errors such as not finding certain files.
Didi you encounter the same issue?
Thanks

    version: "3.3"
services:
  nifi:
    image: apache/nifi
    volumes:
      - /home/ubuntu/nifi/conf:/opt/nifi/nifi-current/conf
      #- ./flow/flow.xml.gz:/opt/nifi/nifi-current/conf/flow.xml.gz
    ports:
      - "8080:8080"

Upvotes: 7

Views: 2782

Answers (2)

3nomis
3nomis

Reputation: 1613

Apparently NiFi doesn't allow you to only persist the flow.xml.gz file, it gives error and the container shuts.
You need to persist the whole /opt/nifi/nifi-current/conf/ folder

Upvotes: 3

costigator
costigator

Reputation: 306

I solved this issue changing the path for the flow.xml.gz to another directory. Here is my docker-compose.yaml for reference:

version: "3.9"
services:

  nifi:
    container_name: nifi
    image: apache/nifi:1.15.0
    ports:
      - 8443:8443
    volumes:
      - ./config:/conf
    environment:
      - SINGLE_USER_CREDENTIALS_USERNAME=admin
      - SINGLE_USER_CREDENTIALS_PASSWORD=S3curePa55word
      - NIFI_SENSITIVE_PROPS_KEY=pUaEVgyGKT61fMCAWNbjJPMwAcQDuDj4
    entrypoint: >
      bash -c "echo Overwriting entrypoint
      && echo Replace path for flow.xml.gz
      && sed -i 's#=./conf/flow.xml.gz#=/conf/flow.xml.gz#g' /opt/nifi/nifi-current/conf/nifi.properties
      && /opt/nifi/scripts/start.sh"

Upvotes: 1

Related Questions