Questo contenuto non è disponibile nella lingua selezionata.

Chapter 4. Deploying Quarkus applications compiled to native executables


You can deploy your native Quarkus application to OpenShift using the Docker build strategy. You need to create a native executable for your application that targets the Linux X86_64 operating system. If your host operating system is different from this, you will need to create a native Linux executable using a container runtime like Docker or Podman.

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.native-dockerfile property.

Prerequisites

  • A Linux X86_64 operating system or an OCI (Open Container Initiative) compatible container runtime, such as Podman or Docker.
  • 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
    2. Set the container runtime:

      quarkus.native.container-build=true
    3. (Optional) If you are using an untrusted certificate, configure the KubernetesClient:

      quarkus.kubernetes-client.trust-certs=true
    4. (Optional) Expose the service to create an OpenShift route:

      quarkus.openshift.expose=true
    5. (Optional) Set the path to your custom Dockerfile:

      quarkus.openshift.native-dockerfile=<path_to_your_dockerfile>

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

      quarkus.openshift.jvm-dockerfile=src/main/docker/Dockerfile.custom-native
    6. (Optional) Specify the container engine:

      • To build a native executable with Podman:

        quarkus.native.container-runtime=podman
      • To build a native executable with Docker:

        quarkus.native.container-runtime=docker
  3. Build a native executable, package, and deploy your application to OpenShift:

    ./mvnw clean package -Pnative -Dquarkus.kubernetes.deploy=true

Verification

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

    oc get pods
  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>
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2026 Red Hat
Torna in cima