Updates as of January 29th, 2019 - Nifi v1.8.0
Nifi’s official docker image has come quite a ways since the first release in 1.2.0. There have been some quality of life changes as well as fixes to things missed on the first run through. We are updating this post for most of those new additions and have a full post about clustering in docker. The readme/quickstart on Nifi’s docker hub page has been fleshed out and contains quite a bit of documentation, so definitely check there for more features.
To start with, there is now a latest tag, so a quick
docker pull apache/nifi now works! Quite a few of the nifi.properties have been exposed via environment variables and you can now run a secured instance, via certificates or LDAP, through the official image. This includes clustering variables such as address, protocol, max threads, zookeeper address, etc. The docker image also now contains the nifi-toolkit, which allows you to manage a cluster and run various commands from the cli. To use the toolikt, after the container is running, you can just run a docker exec command,
docker exec -ti nifi nifi-toolkit-current/bin/cli.sh nifi current-user, to get the current user, which should print out
anonymous. We’ll go into a deeper dive about using the official docker image in our clustering post.
Apache Nifi’s 1.2.0 release, brought with it an official docker image on the docker hub. So let’s get started.
Pull the docker image, note after a latest tag is created you can drop the release version.
docker pull apache/nifi:1.2.0
Next, start the image as is to see it run. The
-p 8080:8080 exposes the remote nifi port locally.
docker run -p 8080:8080 apache/nifi:1.2.0
Last, we can use docker volume to add a custom nar. Split the commands in two so the volume or nar is created before starting the image. Doing it this way will allow you to use the
docker cp command to replace the nifi.properties file too.
docker create --name nifi \ -v /FULL_PATH/sample.nar:/opt/nifi/nifi-1.2.0/lib/sample.nar \ apache/nifi:1.2.0 docker start nifi
Visit localhost:8080 to view nifi.