Skip to main content
Wpq
Gold ⭐️
Jun 24, 2023 10:28 AM UTC
Question

Which directories should be mounted in docker to persist flows?

After having lost all my test work I decided it is time to investigate how to persist data in NiFi when running it in a docker image. I use the official image. This is what I managed to gather so far:

 

services:
nifi:
container_name: nifi
image: apache/nifi:latest
ports:
- "8443:8443"
- "16543:16543"
volumes:
- "C:/nifi/data:/data"
- "C:/nifi/state:/opt/nifi/nifi-current/state"
- "C:/nifi/database:/opt/nifi/nifi-current/database_repository"
- "C:/nifi/flowfile:/opt/nifi/nifi-current/flowfile_repository"
- "C:/nifi/content:/opt/nifi/nifi-current/content_repository"
- "C:/nifi/provenance:/opt/nifi/nifi-current/provenance_repository"

 

When stopping/staring the container everything is OK (login credentials and content)

When removing the container, the credentials are persisted but the content is gone.

 

I presume that there is yet another directory that I should mount in order to have the data saved there. Which one is it?

 

1 reply

LorenzoMusto
Silver ⭐️
Jan 22, 2024 3:20 PM UTC

Flow definitions are saved in the `conf` dir and at least 2 different approaches can be mentioned to backup it: the first by manually `docker cp`its contents and mount them later as a volume at your next run, while the second leveraging the mount bind option of docker to automatically synchronize the `conf` dir contents with your local dir.

Translate