Docker Maven JAVA_HOME
vaughnmb opened this issue · 13 comments
Using the latest version of the maven Docker image, I now get this error: The JAVA_HOME environment variable is not defined correctly.
I never encountered this issue with previous versions of the Maven Docker image. Is this by design and something I need to handle on my end?
what image tag, what command,... are you trying to use
Have same issue when use maven:latest when build docker container (command mvn build clean). When i am change it to maven:3.8.4 all build successful.
Problem start at may 30, because at may 27 everything was good.
what image tag, what command,... are you trying to use
I am trying to use the maven:latest. The command was "mvn clean package"
without more details I cannot help.
This works in this repo
docker run -it --rm -v "$(pwd)"/tests:/usr/src/mymaven -w /usr/src/mymaven maven:latest mvn clean package
what details do you need?
I have Dockerfile with content:
FROM maven:latest as build
WORKDIR /app
COPY mvnw .
COPY .mvn .mvn
COPY pom.xml .
RUN mvn build clean
....
and when im do:
docker build --rm --build-arg VERSION=test --tag test:test .
i get this error:
Step 6/57 : RUN mvn build clean
---> Running in 5587a9575359
The JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program.
if i change Dockerfile to
FROM maven:3.8.4 as build
WORKDIR /app
COPY mvnw .
COPY .mvn .mvn
COPY pom.xml .
RUN mvn build clean
....
all build successful
Problem start at may 30, because at may 27 everything was good.
what's the output of
docker run --rm -it maven:latest bash -c 'env | grep JAVA_HOME; java -version; mvn -version'
docker pull maven:latest
docker run --rm -it maven:latest bash -c 'env | grep JAVA_HOME; java -version; mvn -version'
# docker run --rm -it maven:latest bash -c 'env | grep JAVA_HOME; java -version; mvn -version'
JAVA_HOME=/opt/java/openjdk
[0.032s][warning][os,thread] Failed to start thread - pthread_create failed (EPERM) for attributes: stacksize: 1024k, guardsize: 4k, detached.
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create worker GC thread. Out of system resources.
# An error report file with more information is saved as:
# //hs_err_pid18.log
The JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program.
# docker pull maven:latest
latest: Pulling from library/maven
Digest: sha256:e13f86d46dc9504853f19083674f608dfe2bb0ca95db508b36c5d923888480ad
Status: Image is up to date for maven:latest
docker.io/library/maven:latest
# docker run --rm -it maven:latest bash -c 'env | grep JAVA_HOME; java -version; mvn -version'
JAVA_HOME=/opt/java/openjdk
[0.006s][warning][os,thread] Failed to start thread - pthread_create failed (EPERM) for attributes: stacksize: 1024k, guardsize: 4k, detached.
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create worker GC thread. Out of system resources.
# An error report file with more information is saved as:
# //hs_err_pid17.log
The JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program.
yeah, so it is the same as #281
it will be fixed?
you have the answer in adoptium/containers#215 (comment)
TL;DR upgrade Docker
you have the answer in adoptium/containers#215 (comment) TL;DR upgrade Docker
thx, it work again!