Close Menu
Java HelpsJava Helps
    What's Hot

    Things To Do After Installing IntelliJ IDEA

    December 20, 2022

    How to Set Proxy for IntelliJ IDEA?

    December 20, 2022

    What is Garbage Collection?

    December 7, 2022
    Facebook X (Twitter) Instagram
    Java HelpsJava Helps
    • Home
    • How To
      1. Install
      2. Run
      3. Configure
      4. View All

      How to Install MySQL with phpMyAdmin on Ubuntu?

      December 4, 2022

      Install The Latest IntelliJ IDEA on Linux

      November 28, 2022

      Install The Latest Apache Maven on Linux

      November 27, 2022

      Install The Latest Oracle JDK on Linux

      November 27, 2022

      Run NiFi Cluster in Docker with SSL Enabled

      December 6, 2022

      How to Run Apache NiFi Docker on Mac M1?

      December 1, 2022

      How to Run Apache NiFi on Docker?

      December 1, 2022

      Create A New Maven Project In IntelliJ IDEA

      November 29, 2022

      Things To Do After Installing IntelliJ IDEA

      December 20, 2022

      How to Set Proxy for IntelliJ IDEA?

      December 20, 2022

      How to Set Proxy for Maven?

      December 6, 2022

      How to Create a Fat JAR Using Maven?

      December 5, 2022

      Things To Do After Installing IntelliJ IDEA

      December 20, 2022

      How to Set Proxy for IntelliJ IDEA?

      December 20, 2022

      Manage GitHub Artifact Storage Quota

      December 6, 2022

      Run NiFi Cluster in Docker with SSL Enabled

      December 6, 2022
    • Hello World
      1. Framework
      2. Library
      3. View All

      JPA Hello World! using Hibernate and MySQL

      December 3, 2022

      Jersey 3.x – Hello World!

      December 2, 2022

      Microservices Framework for Java (MSF4J) – Hello World!

      December 1, 2022

      How to Parse PCAP files in Java?

      November 30, 2022

      JPA Hello World! using Hibernate and MySQL

      December 3, 2022

      Jersey 3.x – Hello World!

      December 2, 2022

      Microservices Framework for Java (MSF4J) – Hello World!

      December 1, 2022

      How to Parse PCAP files in Java?

      November 30, 2022
    • More
      • Privacy Policy
        • Java Helps
        • Android Apps
      • Contact US
      • About
    Facebook X (Twitter) Instagram
    Java HelpsJava Helps
    Home » How to Run Apache NiFi Docker on Mac M1?
    NiFi

    How to Run Apache NiFi Docker on Mac M1?

    Gobinath LoganathanBy Gobinath LoganathanDecember 1, 2022Updated:December 4, 2022No Comments2 Mins Read
    Share
    Facebook Twitter LinkedIn Pinterest Email

    The recent article How to Run Apache NiFi on Docker? explains how to run Apache NiFi on Docker. Though it is applicable for traditional x86 or x64 architectures, it does not work for Mac M1 computers. As an alternative still you can run from binary files but Chris Sampson a NiFi committer provided a script to build a NiFi docker image that is compatible with Mac M1. This article explains, how to build an Apache NiFi docker image on your Mac Book M1 and how to run it.

    Create Apache NiFi Docker Image For Mac M1

    Step 1:
    Create a shell script named build-nifi.sh with the following content:

    nifi_version="${1:?'[error] Must provide paramter for NiFi version'}"
    # check nifi_version is correct format
    if [[ ! "${nifi_version}" =~ ^[[:digit:]] \.[[:digit:]] \.[[:digit:]] $ ]]; then
    echo "NiFi Version must be in format 'x.y.z' (where x, y and z are digits)"
    exit 1
    fi

    image_tag="apache/nifi:${nifi_version}-arm64"

    # check this is an arm64 machine (e.g. Mac M1/2)
    arch_name="$(uname -m)"
    if [ "${arch_name}" = "arm64" ]; then
    echo "Running on ARM, buildingarm64 image: ${image_tag}"
    else
    echo "Not running on arm64, skipping image build"
    exit 1
    fi
    echo

    # build from nifi source nifi-docker/dockerhub/
    nifi_repo="https://github.com/apache/nifi.git"
    release_tag="rel/nifi-${nifi_version}"
    echo "Cloning NiFi release tag ${release_tag} from ${nifi_repo}"
    if [ -d nifi ]; then
    echo "Removing existing nifi directory"
    rm -rf nifi/
    fi
    git clone -b "${release_tag}" --single-branch "${nifi_repo}" --depth 1

    # enable buildkit
    export DOCKER_BUILDKIT=1
    builder_name=qemu
    echo "Creating buildx builder: ${builder_name}"
    docker buildx create --use --bootstrap --name="${builder_name}"

    echo; echo; echo "Building image with buildx builder: ${builder_name}"
    pushd nifi/nifi-docker/dockerhub
    docker buildx build --platform linux/arm64 --tag "${image_tag}" --output type=docker .
    popd

    echo; echo; echo "Removing buildx builder: ${builder_name}"
    docker buildx rm -f --builder "${builder_name}"

    Step 2:
    Run the shell script with the latest NiFi version you want to run as shown below. It will take some time and create a new Docker image with the name: apache/nifi:1.16.3-arm64

    sh build-nifi.sh 1.16.3

    Step 3:
    List the Docker images to make sure that the arm64 image is there.

    docker image ls

    Run Apache NiFi Docker Image on Mac M1

    Step 1:
    Now you can run NiFi using the Docker command as explained in How to Run Apache NiFi on Docker? One difference though is you need to change the docker image name to apache/nifi:1.16.3-arm64 and add an extra parameter –platform=linux/arm64. For example, the following command will start Apache NiFi 1.16.3 on port 8443 using the arm64 image in Mac M1.

    docker run --platform=linux/arm64 --name nifi -p 8443:8443 -e SINGLE_USER_CREDENTIALS_USERNAME=admin -e SINGLE_USER_CREDENTIALS_PASSWORD=ctsBtRBKHRAx69EqUghvvgEvjnaLjFEB -d apache/nifi:1.16.3-arm64

    Once NiFi is up and running, visit https://localhost:8443/nifi to access the dashboard.


    Run Apache NiFi on Mac M1 with Docker Compose

    Similarly, you can run NiFi using Docker Compose as explained in Run Apache NiFi Cluster inDocker. Again make sure that you are using the arm64 image you built earlier and define the platform as given below:

    version: "3"
    services:
    zookeeper:
    hostname: zookeeper
    container_name: zookeeper
    image: 'zookeeper:latest'
    ports:
    - 2181
    environment:
    - ALLOW_ANONYMOUS_LOGIN=yes
    nifi:
    image: apache/nifi:1.16.3-arm64
    platform: linux/amd64
    ports:
    - 8080
    environment:
    - NIFI_WEB_HTTP_PORT=8080
    - NIFI_CLUSTER_IS_NODE=true
    - NIFI_CLUSTER_NODE_PROTOCOL_PORT=8082
    - NIFI_ZK_CONNECT_STRING=zookeeper:2181
    - NIFI_ELECTION_MAX_WAIT=1 min
    - NIFI_SENSITIVE_PROPS_KEY=xxxxxxxxxxxx

    Run the cluster using the following docker-compose command:

    docker-compose up

    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.

    big data etl nifi
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

    Related Posts

    Run NiFi Cluster in Docker with SSL Enabled

    December 6, 2022

    Presto SQL for Newbies

    December 4, 2022

    Types of Joins in Presto Explained

    December 4, 2022

    Presto SQL: Join Algorithms Explained

    December 4, 2022

    Jersey 3.x – Hello World!

    December 2, 2022

    How to Run Apache NiFi on Docker?

    December 1, 2022
    Don't Miss
    Configure

    Things To Do After Installing IntelliJ IDEA

    December 20, 2022

    IntelliJ Idea: the famous IDE for JVM languages including Java, Scala, and Kotlin. If you…

    How to Set Proxy for IntelliJ IDEA?

    December 20, 2022

    What is Garbage Collection?

    December 7, 2022

    Manage GitHub Artifact Storage Quota

    December 6, 2022
    Our Picks

    Things To Do After Installing IntelliJ IDEA

    December 20, 2022

    How to Set Proxy for IntelliJ IDEA?

    December 20, 2022

    What is Garbage Collection?

    December 7, 2022

    Manage GitHub Artifact Storage Quota

    December 6, 2022
    About Us
    About Us

    Java Helps is the platform to share all about the Java ecosystem. All the sample code available on Java Helps articles are published under Apache 2.0 License. Readers are free to use them according to the Apache 2.0 License.

    "The world is my town; its people my kinsmen."
    -Kaṉiyan Pūngunṟanār

    Email Us: www.javahelps@gmail.com

    Our Picks

    Things To Do After Installing IntelliJ IDEA

    December 20, 2022

    How to Set Proxy for IntelliJ IDEA?

    December 20, 2022

    What is Garbage Collection?

    December 7, 2022
    New Comments

      Type above and press Enter to search. Press Esc to cancel.

      Go to mobile version