Apache NiFi: the famous ETL tool to integrate different data endpoints together provides a friendly GUI to control data pipelines even for non-techy people. For anyone who wants to play with Apache NiFi, running Apache NiFi on Docker is an easy solution to get quick access. Running Apache NiFi on 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 are using Mac Silicon M1/M2, follow this article instead: How to Run Apache NiFi Docker on Mac M1?

Spin Up Apache NiFi on 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

Extract the Credentials from Logs

Step 1:
Run the following command to get the NiFi logs from the Docker container.

docker logs -f nifi

Step 2:
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 dashboard is running at port number 8443. This port number must be the same as the port number defined in the docker run command.

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 start NiFi with your own username and password, use the following command instead:

docker run --name nifi -p 8443:8443 -e SINGLE_USER_CREDENTIALS_USERNAME=admin -e SINGLE_USER_CREDENTIALS_PASSWORD=ctsBtRBKHRAx69EqUghvvgEvjnaLjFEB -d apache/nifi:latest

Access Apache NiFi Dashboard

Step 1:

Visit https://localhost:8443/nifi. The browser may warn you that the connection is not private because the SSL certificate is not valid. Ignore the warning and proceed to the site.


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

If you find this article useful, please share your thoughts below. If you have any questions or issues with getting Apache NiFi running on Docker, you can ask your questions in the comments. Java Helps community will try our best to answer your questions.

Share.
Exit mobile version