3

I used docker to build a java program, the beginning of the Dockerfile is

FROM openjdk:8-jdk-alpine

but I notice the jvm command jinfo has no -flags, what is wrong?

    bash-4.4# ./jinfo
    Usage:
        jinfo <option> <pid>
           (to connect to a running process)

    where <option> is one of:
        -flag <name>         to print the value of the named VM flag
        -flag [+|-]<name>    to enable or disable the named VM flag
        -flag <name>=<value> to set the named VM flag to the given value
        -h | -help           to print this help message
lily
  • 515
  • 7
  • 20

1 Answers1

3

JDK for Alpine is built without Serviceability Agent support, because SA relies on the features that musl does not have.

Some JDK utilities use Serviceability Agent under the hood for certain functions. jinfo -flags is an example of such utility. Other examples that also use SA under the hood are jmap -F and jstack -F. These options are also unavailable in Alpine JDK. In this answer I described how the forced mode (-F) differs from the normal mode, and what role Serviceability Agent plays there.

jinfo -flags can be replaced with jcmd <pid> VM.flags.

jcmd does not rely on SA, and it works on Alpine Linux.

apangin
  • 92,924
  • 10
  • 193
  • 247