You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Java version labels to Java distroless images #276
The actual code that does this is package_manager/dpkg_parser.py and package_manager/parse_metadata.py. (However, seems like it pulls in a compiled dpkg_parser.par binary from a GCS bucket though.) I wonder if we can utilize this existing infrastructure. Might need some work though.
I looked at the other significant Java images on Docker Hub, and also looked at Official Docker Images for other languages, and compiled a list of container metadata including labels and environment variables (see details below).
The Official Docker Images for Java (openjdk), PHP, Python, Node, and Ruby all define a LLLL_VERSION environment variable with the runtime version (where LLLL = {JAVA, PHP, PYTHON, NODE, PYTHON}). The openjdk builds use the Java version such as 8u192 or 11.0.2. AdoptOpenJDK also provide a JAVA_VERSION but it uses a form like jdk-11.0.2+13. Neither Azul Zulu (and Microsoft's variant of Zulu) nor Amazon Corretto provide any version metadata. None define any labels except for Fabric8's images which are actually inherited from their CentOS base image.
So although I support defining labels, we should also define a JAVA_VERSION in keeping with the Official OpenJDK Docker Image.
With respect to labels, in GoogleContainerTools/jib#1402 I found that OCI defines a standard set of labels, based on the efforts of label-schema.org. and also defines set of rules for the format of these labels, including that the keys should use a reverse-domain-name format.
#291 adds a JAVA_VERSION environment variable to the built images. I intended to add the jdk.vendor and jdk.version labels as requested here but both Docker and OCI recommend namespacing labels/annotations using reverse-DNS prefixes.
Activity
loosebazooka commentedon Jan 16, 2019
@mattmoor @dlorenc is there way to extract "Version" from the pkg metadata and expose it as a label during build?
loosebazooka commentedon Jan 16, 2019
Potentially 2 ways to do this without executing java/dpkg:
<package-name>_<version>_<architecture>.debVersion: <version>.debs seem to contain a control archivecontrol.tar.gzwith a control filecontrolwhich contains this version.chanseokoh commentedon Jan 25, 2019
I've briefly thought about this. The current repo setup downloads the entire metadata list of all the packages from a certain Debian snapshot archive (for example, the metadata list file is https://snapshot.debian.org/archive/debian/20190125T150847Z/dists/stretch/main/binary-amd64/Packages.gz). The setup actually downloads and unpacks such a file and parses it. (In the end, it parses it into a JSON.) It is easy to check the contents of the metadata manually:
The actual code that does this is
package_manager/dpkg_parser.pyandpackage_manager/parse_metadata.py. (However, seems like it pulls in a compileddpkg_parser.parbinary from a GCS bucket though.) I wonder if we can utilize this existing infrastructure. Might need some work though.chanseokoh commentedon Jan 25, 2019
BTW, here's basically what's happening in this repo.
Then the script above will download/generate the following files:
A different set of flags can be used as well (which are being used for the
debian-securityarchives).chanseokoh commentedon Jan 28, 2019
Looking into the
$JAVA_HOME/releasecould work too.briandealwis commentedon Jan 28, 2019
I don't think the Debian packages provide the
/releasefile.https://debian.pkgs.org/9/debian-main-amd64/openjdk-8-jre-headless_8u181-b13-2~deb9u1_amd64.deb.html
briandealwis commentedon Feb 4, 2019
I looked at the other significant Java images on Docker Hub, and also looked at Official Docker Images for other languages, and compiled a list of container metadata including labels and environment variables (see details below).
The Official Docker Images for Java (
openjdk), PHP, Python, Node, and Ruby all define aLLLL_VERSIONenvironment variable with the runtime version (where LLLL = {JAVA, PHP, PYTHON, NODE, PYTHON}). Theopenjdkbuilds use the Java version such as8u192or11.0.2. AdoptOpenJDK also provide aJAVA_VERSIONbut it uses a form likejdk-11.0.2+13. Neither Azul Zulu (and Microsoft's variant of Zulu) nor Amazon Corretto provide any version metadata. None define any labels except for Fabric8's images which are actually inherited from their CentOS base image.So although I support defining labels, we should also define a
JAVA_VERSIONin keeping with the Official OpenJDK Docker Image.With respect to labels, in GoogleContainerTools/jib#1402 I found that OCI defines
a standard set of labels, based on the efforts of label-schema.org. and also defines set of rules for the format of these labels, including that the keys should use a reverse-domain-name format.
openjdk:11-jre-alpineopenjdk:10-jre-alpinebriandealwis commentedon Feb 14, 2019
#291 adds a
JAVA_VERSIONenvironment variable to the built images. I intended to add thejdk.vendorandjdk.versionlabels as requested here but both Docker and OCI recommend namespacing labels/annotations using reverse-DNS prefixes.It's easy to add labels to a
container_imagedefinition:briandealwis commentedon Feb 14, 2019
Oops, meant to mention that
JAVA_VERSIONis of the form:8u181: ondistroless/java:811.0.1: ondistroless/java:11