This repository contains a PoC about building Java images using jib
-
I am using a local Docker registry instance. More about it here. It listens at
localhost:5000
-
Also Java distroless base images are being used.
mvn clean package
...
[INFO] Using base image with digest: sha256:69ac1ba2b76e5376487300e4a379f97306b30a6d693679d3af01cc6d8923360e
[INFO]
[INFO] Container entrypoint set to [java, -cp, @/app/jib-classpath-file, jib.Client]
[INFO]
[INFO] Built and pushed image as localhost:5000/jib:0.0.1-SNAPSHOT
[INFO] Executing tasks:
[INFO] > launching layer pushers
...
jib build goal is bind to package
mvn lifecycle. See pom.xml
for more details.
docker run --rm -it --name jib-poc -e sleep=1000 localhost:5000/jib:0.0.1-SNAPSHOT
If we use Dive to inspect the resulting image.
Each jib-maven-plugin
layer is explained here
Jib is not intended to be used as a containerized jar
. It copies all resources in each layer, caching and making a fast image.
docker inspect --format='{{.Config.Entrypoint}}' localhost:5000/jib:0.0.1-SNAPSHOT
[java -cp @/app/jib-classpath-file jib.Client]