Run on docker / alpine

Hi there,

I’m trying to execute maven test into docker container.
I have this error :

ND4J is not supported ?

what do I have to do ?

thx.

Can you share your Dockerfile with us? So we know what your Environment inside the container is?

Sure :

PATH=/opt/openjdk-13/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/tmp/ant/bin
JAVA_HOME=/opt/openjdk-13
JAVA_VERSION=13-ea+19
JAVA_URL=https://download.java.net/java/early_access/alpine/19/binaries/openjdk-13-ea+19_linux-x64-musl_bin.tar.gz
JAVA_SHA256=010ea985fba7e3d89a9170545c4e697da983cffc442b84e65dba3baa771299a5
MAVEN_HOME=/usr/share/maven
MAVEN_CONFIG=/root/.m2
OPENCV_VERSION=4.1.2
OPENCV_SRC_URL=https://codeload.github.com/opencv/opencv/tar.gz/4.1.2
OPENCV_INSTALL_PREFIX=/usr/local/opencv
OPENCV_TMP_DIR=/tmp/opencv
OPENCV_BIN=/opt/opencv-java-bin
ANT_VERSION=1.10.1
ANT_BIN_URL=http://archive.apache.org/dist/ant/binaries/apache-ant-1.10.1-bin.tar.gz
ANT_TMP_DIR=/tmp/ant
ANT_HOME=/tmp/ant
LD_LIBRARY_PATH=/opt/opencv-java-bin
TZ=Europe/Paris
LANG=fr_FR.UTF-8
LC_ALL=C
HOME=/

I meant the actual Dockerfile, not the environment variables.

I just have the image, i take a look to retrieve the dockerfile.

I go into that image and run “mvn test” into app project folder, so i guess you want the image parent dockerfile, not the dockerfile of my project ?

I can follow back through the hierarchy of dockerfiles staring from yours, unless you aren’t using public base images.

But I guess the most likely reason you are seeing problems is that you are using a system with musl libc, not glibc.

Take a look at these issues:


1 Like
ARG MAVEN_VERSION="3"
ARG JDK_VERSION="13"

FROM maven:${MAVEN_VERSION}-jdk-${JDK_VERSION}-alpine

# We must keep this after FROM, otherwise it is removed
ARG JDK_VERSION="13"

ENV ANT_VERSION "1.10.1"
ENV ANT_BIN_URL "http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz"
ENV ANT_TMP_DIR "/tmp/ant"
ENV ANT_HOME "${ANT_TMP_DIR}"
ENV LD_LIBRARY_PATH "${OPENCV_BIN}"
ENV PATH "${PATH}:${ANT_HOME}/bin"
ENV TZ "Europe/Paris"
ENV LANG "fr_FR.UTF-8"
ENV LC_ALL "C"

WORKDIR /app/


COPY settings.xml ${MAVEN_HOME}/ref/
COPY settings.xml ${MAVEN_HOME}/conf/
COPY pom.xml ./
COPY project/pom.xml project/


ARG MVN_OPTS=""
RUN /usr/local/bin/mvn-entrypoint.sh mvn \
      dependency:go-offline \
      -B \
      -Dmaven.artifact.threads=4 \
      ${MVN_OPTS}

RUN rm -rf /app/*
RUN chown -R 1000: ${MAVEN_HOME}

Why is it that you are building opencv manually? Doesn’t the version that you can get via javacpp presets not work for you?

Because before we use openCV without DL4J :slight_smile:

Given all of that, it looks like it is again an incompatibility between musl and glibc.

So either you use a different base image that uses glibc instead of musl or you try using the solutions from the links I’ve posted.

1 Like

Yes, ND4J needs glibc. You probably won’t be able to use it with a version of JDK that doesn’t use glibc.

1 Like