Ad Code

Ticker

6/recent/ticker-posts

Quarkus - Create Docker Image and Publish to Docker hub using Quarkus Jib Maven Plugin

In our previous examples we have seen how to create Docker Image and Publish to Docker hub registry using Jib Maven Plugin and using Jib Gradle Plugin for a Spring Boot Application. In this example we are going to see how we can achieve the same for Quarkus application.

Prerequisites To complete this example:

  • An IDE
  • JDK 11+ installed with JAVA_HOME configured appropriately
  • Apache Maven 3.8.1+
  • Docker Desktop

Here are the Steps:

1. Create a maven project using Quarkus and to use Jib we can remove the docker file add the below Dependencies in pom.xml.

2. Update the application.properties file with below properties:
quarkus.container-image.build = true
quarkus.container-image.group = rajivksingh13
quarkus.container-image.name = quarkus-teachlea
quarkus.container-image.tag = 1.0.1cls
quarkus.container-image.registry = registry.hub.docker.com
quarkus.container-image.username = *******
quarkus.container-image.password = *******
quarkus.container-image.push = true
3. Go to root of the project and run this command "mvn clean package" with this it will create the docker image of our Quarkus application and publish to docker hub registry as shown in the below snipped:


4. Login to docker hub and check the image have been pushed successfully.


5. Now its time run and test our docker image, for this use the below command, you can see it will first try to find the docker image locally but unable to find out. So Next it will try to pull the image from remote Docker Hub Registry.

docker run -i --rm -p 8080:8080 rajivksingh13/quarkus-teachlea:1.0.1cls


6. Now open http://localhost:8080/hello in any browser and test our Rest End Point:

Summary:
So in this Example we have implemented and seen how can we Containerize a Quarkus Application using Quarkus Jib Maven Plugin

GitHub Link : rajivksingh13/teachlea

Please feel free to provide your valuable comments, Thanks.

Ref:  
https://quarkus.pro/guides/container-image.html
https://quarkus.io/guides/container-image



Post a Comment

0 Comments

Ad Code