Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Maven JAVA_HOME #282

Closed
vaughnmb opened this issue May 29, 2022 · 13 comments
Closed

Docker Maven JAVA_HOME #282

vaughnmb opened this issue May 29, 2022 · 13 comments

Comments

@vaughnmb
Copy link

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?

@ghost
Copy link

ghost commented May 30, 2022

May be related to #281 ? (Just based on timing, I did not look into it)

@carlossg
Copy link
Owner

what image tag, what command,... are you trying to use

@mpaktheone
Copy link

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.

@carlossg
Copy link
Owner

what image tag, what command,... are you trying to use

@vaughnmb
Copy link
Author

I am trying to use the maven:latest. The command was "mvn clean package"

@carlossg
Copy link
Owner

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

@mpaktheone
Copy link

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.

@carlossg
Copy link
Owner

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'

@mpaktheone
Copy link

mpaktheone commented May 31, 2022

# 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.

@carlossg
Copy link
Owner

yeah, so it is the same as #281

@mpaktheone
Copy link

yeah, so it is the same as #281

it will be fixed?

@carlossg
Copy link
Owner

you have the answer in adoptium/containers#215 (comment)
TL;DR upgrade Docker

@mpaktheone
Copy link

you have the answer in adoptium/containers#215 (comment) TL;DR upgrade Docker

thx, it work again!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants