为什么 jvm 命令 `jinfo` 在 alpine openjdk8 发行版中没有 `-flags`?

Why doesn't jvm command `jinfo` have `-flags` in alpine openjdk8 distribution?

我用docker构建了一个java程序,Dockerfile的开头是

FROM openjdk:8-jdk-alpine

但我注意到 jvm 命令 jinfo 没有 -flags,怎么了?

    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

JDK 因为 Alpine 是在没有 Serviceability Agent support, because SA relies on the features that musl does not have.

的情况下构建的

一些 JDK 实用程序在后台使用可维护性代理来实现某些功能。 jinfo -flags 是此类实用程序的一个示例。其他也在幕后使用 SA 的例子是 jmap -Fjstack -F。这些选项在 Alpine JDK 中也不可用。 在 this answer 中,我描述了强制模式 (-F) 与正常模式的区别,以及 Serviceability Agent 在其中扮演的角色。

jinfo -flags可以换成jcmd <pid> VM.flags.

jcmd 不依赖 SA,在 Alpine Linux.

上有效