Run Apache NiFi in Docker

Running Apache NiFi in Docker is a simple and hassle-free process if you know the port to access. This article explains how to get Apache NiFi running in Docker on a Linux machine. If you don't have already, install Docker first.

Run Apache NiFi in Docker

Step 1:
Pull the latest Nifi image from the docker repository.

docker pull apache/nifi:latest


Step 2:
Run Apache Nifi as a docker container.
docker run --name nifi -p 8443:8443 -e NIFI_WEB_HTTPS_PORT='8443' -d apache/nifi:latest


Step 3:
Run the following command to get the NiFi logs from the Docker container.
docker logs -f nifi


Step 4:
Look for the following line to get the port Apache NiFi is running.
INFO [main] org.apache.nifi.web.server.JettyServer https://4cdc79d1487f:8443/nifi
Above line tells that the NiFi frontend is running at port number 8443. This port number must be same as the port number defined in Step 2.

Scroll further up and look for the lines with the temporary username and password.
Generated Username [xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx]
Generated Password [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
Copy the username and password.

In a production environment, the username and password must be configured manually. However, the scope of this article is limited to just spinning up a NiFi container for testing. Therefore, we can continue with the temporary username and password.
 
To change the username and password, use the following command:
docker run --name nifi -p 8443:8443 -e SINGLE_USER_CREDENTIALS_USERNAME=admin -e SINGLE_USER_CREDENTIALS_PASSWORD=ctsBtRBKHRAx69EqUghvvgEvjnaLjFEB -d apache/nifi:latest
 


Step 5:
Visit https://localhost:8443/nifi. The browser may wan you that the connection is not private because the SSL certificate is not valid. Ignore the warning and proceed to the site.
 
Run Apache NiFi in Docker


Step 6:
Use the username and password copied in Step 4 to log in to the Apache NiFi dashboard.

Run Apache NiFi in Docker

If you have any problems getting this working or if you find this article helpful, please leave a comment below. To run Apache NiFi as a cluster in Docker, read the next article: Run Apache NiFi Cluster in Docker.
Previous
Next Post »

2 comments

Write comments
Kevin Biondi
AUTHOR
May 20, 2022 at 8:14 PM delete

This was great and i can run nifi locally on my local windows 11 machine with docker. The problem that I am having and it's driving me crazy is accessing nifi from the browser on a remote machine (my windows 11 machine) on the same network that is running the latest dockerized nifi in a rhel 8 variant virtual machine. I get host header errors. If I am on my remote machine and enter https://centos8-vm1:8443/nifi I see see the warning in the nifi application log in the container and get the host header error in the browser. Don't know what to do. Thanks!

Reply
avatar
Kevin Biondi
AUTHOR
May 21, 2022 at 11:03 AM delete

figured it out! If you to run the new version of Nifi in a docker conainer on another machine or VM and access from another machine do the following to the docker run --name nifi -p 8443:8443 -e NIFI_WEB_HTTPS_PORT='8443' -e NIFI_WEB_PROXY_HOST='localhost:8443','192.168.1.30:8443' NIFI_-d apache/nifi:latest

Reply
avatar

Contact Form

Name

Email *

Message *