Chapter 3. Deploying Quarkus Java applications to OpenShift


By using the Quarkus OpenShift extension, you can deploy your application to OpenShift using the Docker build strategy. The container is built inside the OpenShift cluster and provided as an image stream.

Your Quarkus project includes pre-generated Dockerfiles with instructions. When you want to use a custom Dockerfile, you need to add the file in the src/main/docker directory or anywhere inside the module. Additionally, you need to set the path to your Dockerfile using the quarkus.openshift.jvm-dockerfile property.

Prerequisites

  • Have a Quarkus Maven project that includes the quarkus-openshift extension.
  • Login to OpenShift using oc and select your project.

Procedure

  1. Change to the directory that contains your Quarkus project.
  2. Configure the following properties in your application.properties file:

    1. Set the Docker build strategy:

      quarkus.openshift.build-strategy=docker
      Copy to Clipboard Toggle word wrap
    2. (Optional) If you are using an untrusted certificate, configure the KubernetesClient:

      quarkus.kubernetes-client.trust-certs=true
      Copy to Clipboard Toggle word wrap
    3. (Optional) Expose the service to create an OpenShift route:

      quarkus.openshift.expose=true
      Copy to Clipboard Toggle word wrap
    4. (Optional) Set the path to your custom Dockerfile:

      quarkus.openshift.jvm-dockerfile=<path_to_your_dockerfile>
      Copy to Clipboard Toggle word wrap

      The following example shows the path to the Dockerfile.custom-jvm:

      quarkus.openshift.jvm-dockerfile=src/main/resources/Dockerfile.custom-jvm
      Copy to Clipboard Toggle word wrap
  3. Package and deploy your Quarkus application to the current OpenShift project:

    ./mvnw clean package -Dquarkus.kubernetes.deploy=true
    Copy to Clipboard Toggle word wrap

Verification

  1. View a list of pods associated with your current OpenShift project:

    oc get pods
    Copy to Clipboard Toggle word wrap
  2. To retrieve the log output for your application’s pod, enter the following command where <pod_name> is the name of the latest pod prefixed with the name of your application:

    oc logs -f <pod_name>
    Copy to Clipboard Toggle word wrap
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat