Samoth
Samoth

Reputation: 756

apache/nifi docker: how to commit changes to new container

I'm new to apache/nifi and run it with :

docker run --name nifi -p 8081:8080 -d apache/nifi:latest

and then dragged some processors. And then I tried to save them as new image using:

 docker commit [container ID] apache/nifi:latest

But it does not save the changes when I run the new committed image. Please advice me if any mistake. Thanks in advance.

Update
At first I launched nifi with:

docker run --name nifi -p 8081:8080 -d apache/nifi:latest

This is the group I added on the web UI: enter image description here

I want to save the container so I committed with following command:

docker commit 1e7 apache/nifi:latest2

we can see 2 nifi images here: enter image description here

Then I run:

docker run --name newnifi -p 8080:8080 -d apache/nifi:latest2

to chekc if the changes are saved in the new image. But the Web UI is empty and the group is not there. enter image description here

Upvotes: 2

Views: 1443

Answers (2)

Murtaza Haji
Murtaza Haji

Reputation: 1193

This is coming from discussion on official slack channel for Apache Nifi.

Looks like the flow definitions are stored in the flow.xml.gz in the /conf directory. The apache/nifi docker image defines this folder as volume.

Directories defined as volumes are not committed to images created from existing containers. https://docs.docker.com/engine/reference/commandline/commit/#extended-description.
That's why the processors and groups are not showing up in the new image.

These are the alternatives to consider:

  1. Copying the flow.xml.gz file to your new container.
  2. Exporting a template of your flow (this is deprecated but still usable).
  3. Using NiFi Registry to store your flow definition, then import from there.

Upvotes: 2

John Dow
John Dow

Reputation: 806

docker commit is for creating a new image from a container’s changes, meaning when you update or add new config or install new software, thus creating a new template images. Simply issue the docker stop NAME_OF_CONTAINER and when you would like to restart it docker start NAME_OF_CONTAINER

Upvotes: 1

Related Questions