1. Create Docker Images with Container-Extension
1.1. Push Quarkus Image in a (Local) Registry
1.1.1. Create a Simple Quarkus Project with Jib
Source: Udemy Course: Quarkus Backend development with Java and GraalVM created by Dmytro Chaban
mvn io.quarkus:quarkus-maven-plugin:2.16.4.Final:create \
-DprojectGroupId=at.htl \
-DprojectArtifactId=containers \
-DclassName="at.htl.WeatherResource" \
-Dpath="/weather" \
-Dextensions="container-image-jib"
or add the extension to an existing project
./mvnw quarkus:add-extension -Dextensions="container-image-jib"
1.1.2. Start a Docker Container with a Docker Registry
We use this Image
docker run -d -p 5000:5000 --restart always --name registry registry:2
check, if the container is running
docker ps
terminal output
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ee0da556eced registry:2 "/entrypoint.sh /etc…" 19 seconds ago Up 18 seconds 0.0.0.0:5000->5000/tcp registry
1.1.4. Configure the Quarkus Project
src/main/resources/application.properties
quarkus.container-image.registry=localhost:5000
quarkus.container-image.insecure=true
docker images
terminal output
REPOSITORY TAG IMAGE ID CREATED SIZE stuetz/containers 1.0-SNAPSHOT df644dfa092e 5 minutes ago 199MB ...
1.1.5. Push the Quarkus Project Image into the Registry
./mvnw clean package -Dquarkus.container-image.push=true
Alternative to jib (do not use)
#docker tag 22c42a7b1261 localhost:5000/containers
docker tag stuetz/containers:1.0-SNAPSHOT localhost:5000/containers
docker push localhost:5000/containers
1.2. Change to Docker-Plugin from Jib-Plugin
pom.xml
...
<version>1.0.1-SNAPSHOT</version>
...
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-container-image-docker</artifactId> (1)
</dependency>
...
1 | replace quarkus-container-image-jib with quarkus-container-image-docker |
It’s also working, like with Jib
./mvnw clean package -Dquarkus.container-image.build=true
./mvnw clean package -Dquarkus.container-image.push=true
http :5000/v2/_catalog
http :5000/v2/stuetz/containers/tags/list