1 year ago

#335301

test-img

TheAkashKamble

Not able to change JVM options ( xmx, xms etc. ) with openjdk:8 based docker container

I am trying set xmx and xms parameters for my java application which is inside docker container. When I try with adoptopenjdk it works fine.

With AdoptOpenjdk

Dockerfile :

FROM adoptopenjdk/openjdk8-openj9:alpine
WORKDIR /
ADD /target/*.jar app.jar
...

Docker compose

  myapp:
    image: myapp:dev
    container_name: myapp
    network_mode: "host"
    ports:
      - "PORT:PORT"
    environment:
      - OPENJ9_JAVA_OPTIONS=-Xmx1400m -Xms1400m -XX:+UseContainerSupport

enter image description here

But the same thing is not working with openjdk:8

Dockerfile

FROM openjdk:8
WORKDIR /
ADD /target/*.jar app.jar
...   

Docker Compose file

  myapp:
    image: myapp:dev
    container_name: myapp
    network_mode: "host"
    ports:
      - "PORT:PORT"
    environment:
      - JAVA_OPTS=-Xmx1400m -Xms1400m -XX:+UseContainerSupport

enter image description here

java

docker

adoptopenjdk

0 Answers

Your Answer

Accepted video resources