[ 
https://issues.apache.org/jira/browse/NIFI-9177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17552621#comment-17552621
 ] 

Chris Sampson commented on NIFI-9177:
-------------------------------------

Worth noting that this is on the community's wish list to provide in the future 
(https://cwiki.apache.org/confluence/display/NIFI/NiFi+Docker+Container+Improvements).

In the meantime, I've had some success locally by building the image from 
source using the Docker Buildkit/Buildx with {{qemu}} emulation:

{code:bash}
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}"
{code}

This image then appears to run and be stable on an M1 machine at least.

> Provide ARM64 docker Images for Apache Nifi
> -------------------------------------------
>
>                 Key: NIFI-9177
>                 URL: https://issues.apache.org/jira/browse/NIFI-9177
>             Project: Apache NiFi
>          Issue Type: Wish
>          Components: Docker
>    Affects Versions: 1.14.0
>            Reporter: Vaibhav Pal Singh
>            Priority: Major
>              Labels: arm64, docker
>
> Docker for mac is not able to correctly emulate the amd64 binaries for apache 
> nifi. 
> Request to provide arm64 images for apache nifi, now that the apple M1 
> hardware is becoming very popular among developer community as well.
> The error logs as follows :
> {code:java}
> 2021-08-29 04:36:48,799 WARN [main] org.apache.nifi.web.server.JettyServer 
> Failed to start web server... shutting down.2021-08-29 04:36:48,799 WARN 
> [main] org.apache.nifi.web.server.JettyServer Failed to start web server... 
> shutting down.java.io.IOException: Function not implemented at 
> sun.nio.fs.LinuxWatchService.<init>(LinuxWatchService.java:64) at 
> sun.nio.fs.LinuxFileSystem.newWatchService(LinuxFileSystem.java:47) at 
> org.apache.nifi.nar.NarAutoLoader.start(NarAutoLoader.java:68) at 
> org.apache.nifi.web.server.JettyServer.start(JettyServer.java:1229) at 
> org.apache.nifi.NiFi.<init>(NiFi.java:159) at 
> org.apache.nifi.NiFi.<init>(NiFi.java:71) at 
> org.apache.nifi.NiFi.main(NiFi.java:303)2021-08-29 04:36:48,830 INFO 
> [Thread-1] org.apache.nifi.NiFi Initiating shutdown of Jetty web server...
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to