이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 5. Deploying Red Hat build of Quarkus applications compiled to native executables


You can deploy your native Quarkus applications to OpenShift Container Platform compiled to native executables by using the Docker build strategy.

You must create a native executable for your application that targets a supported operating system and match the architecture. This means, if you are building on Windows, you create a native Linux executable by using a container runtime, for example, Docker or Podman.

Your Quarkus project includes pregenerated Dockerfiles with instructions. If you want to use a custom Dockerfile, add the file to the src/main/docker directory or any location inside the module. Additionally, if you want to have multiple Docker files and switch between them, set the path to your preferred Dockerfile by using the quarkus.openshift.native-dockerfile property.

Note

This guide describes this strategy by using a Quarkus project with Maven as the example project.

5.1. Prerequisites

  • A supported operating system or an Open Container Initiative (OCI) compatible container runtime, such as Podman or Docker.
  • You have a Quarkus Maven project that includes the quarkus-openshift extension.
  • You have access to an OpenShift Container Platform cluster and the latest compatible version of the oc CLI tool installed.
  • You are working in the correct OpenShift project namespace.

5.2. Procedure

  1. Set the Docker build strategy in your application.properties configuration file:

    quarkus.openshift.build-strategy=docker
    Copy to Clipboard Toggle word wrap
  2. Enable container-based native builds:

    quarkus.native.container-build=true
    Copy to Clipboard Toggle word wrap
  3. Optional: Set the following properties in the application.properties file based on your environment:

    • If you are using an untrusted certificate, enable certificate trust for the KubernetesClient:

      quarkus.kubernetes-client.trust-certs=true
      Copy to Clipboard Toggle word wrap
    • To expose the service and create an OpenShift Container Platform route, set the following property:

      quarkus.openshift.route.expose=true
      Copy to Clipboard Toggle word wrap
    • To use a custom Dockerfile instead of the pregenerated Dockerfiles, set the path to your custom Dockerfile:

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

      For example, to specify a custom Dockerfile named Dockerfile.custom-native:

      quarkus.openshift.native-dockerfile=src/main/docker/Dockerfile.custom-native
      Copy to Clipboard Toggle word wrap
    • Specify the container engine:

      • To build a native executable with Podman:

        quarkus.native.container-runtime=podman
        Copy to Clipboard Toggle word wrap
      • To build a native executable with Docker:

        quarkus.native.container-runtime=docker
        Copy to Clipboard Toggle word wrap
  4. Finally, build the native executable, package, and deploy your application to OpenShift Container Platform:

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

5.3. Verification

  1. Verify that an image stream and a service resource are created, and that the application is deployed. Use the OpenShift Container Platform web console or the following OpenShift Container Platform command-line interface (CLI) commands:

    oc get is 
    1
    
    oc get pods 
    2
    
    oc get svc 
    3
    Copy to Clipboard Toggle word wrap
    1
    List the image streams created.
    2
    List the pods associated with your current OpenShift project.
    3
    List the Kubernetes services.
  1. To get the log output for your application’s pod, run 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

5.4. References

맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat