ネイティブ実行可能ファイルの生成
Quarkus applications can be compiled to native executables, producing a standalone binary that starts in milliseconds and uses a fraction of the memory of a JVM process.
In this guide, you will compile the application from the Getting Started Guide to a native executable, test it, and package it in a container.
Do you need a native executable?
Quarkus on the JVM is already fast, sub-second startup, low memory footprint, and optimized throughput. For many applications, JVM mode is the right choice.
Native executables shine when:
-
Startup time is critical: serverless/FaaS, CLI tools, or scale-to-zero environments where cold starts matter.
-
Memory is constrained: dense container deployments or edge devices with tight RAM budgets.
-
You want the smallest possible container image: native binaries produce images under 50MB.
JVM mode is typically better when:
-
Peak throughput matters most: the JVM’s JIT compiler optimizes hot paths at runtime, which can outperform native on long-running workloads.
-
Build time is a constraint: native compilation takes minutes, JVM builds take seconds.
-
You rely heavily on reflection or dynamic class loading: these require explicit configuration for native images.
| Start with JVM mode. Move to native when you have a concrete need. Both modes use the same code and the same Quarkus optimizations: native just changes how the binary is produced. |
Comparing JVM, Leyden AOT, and native modes
Native is one of three runtime options Quarkus supports. JVM fast-jar, JVM with Project Leyden AOT caching (JDK 24+), and native (Mandrel) each trade cold-start speed, peak throughput, memory footprint, and build cost differently. The table below compares them. Pick the mode that matches your workload’s most important constraint.
| Mode | Cold start | Time to first request | Peak throughput | Memory (RSS) | コンテナーイメージサイズ | Build cost | When to choose |
|---|---|---|---|---|---|---|---|
JVM fast-jar |
~0.4 s (small REST) to ~3 s (large CRUD) |
4,417 ms |
13,265 tps (baseline) |
304 MiB |
517 MB |
~30 s build; no special workflow |
Long-running services, throughput-critical workloads; teams on pre-JDK-24 runtimes |
~80 ms (small) to ~900 ms (large) |
1,859 ms |
12,389 tps (~7% below JVM) |
240 MiB |
715 MB (AOT cache adds ~198 MB) |
Standard build plus a training run on a representative workload |
Cold-start-sensitive but not millisecond-critical; requires JDK 24+; keeps full JVM tooling (debuggers, profilers, JFR) |
|
Native (Mandrel) |
~17 ms (small) to ~240 ms (large) |
581 ms |
5,411 tps (~59% below JVM) |
95 MiB |
244 MB |
3-10 min build; 4-8 GB build-host RAM |
Extreme cold start (serverless, scale-to-zero); edge deployments; high-density container hosts where memory is the binding constraint |
Time to first request, peak throughput, and memory (RSS) come from the 2026-04-21 perf-lab tuned benchmark (Quarkus 3.34.3, JDK 25.0.2, GraalVM 25.0.2-graalce, 4 CPUs, -Xmx512m).
Cold-start ranges and container image sizes come from the Leyden integration benchmarks and the Mar 2026 performance post.
For the latest numbers, see the Quarkus benchmarks chart reference.
For the Leyden AOT cache path, see the AOT caching guide. If native is the right fit for your workload, read on. The next sections walk you through prerequisites, compilation, testing, and container packaging.
前提条件
このガイドを完成させるには、以下が必要です:
-
約15分
-
IDE
-
JDK 17+がインストールされ、
JAVA_HOMEが適切に設定されていること -
Apache Maven 3.9.16
-
動作するコンテナランタイム(Docker, Podman)
-
使用したい場合は、 Quarkus CLI
-
Mandrel または GraalVM がインストールされ、 適切に設定されていること
-
入門ガイドで開発したアプリケーションのコード
|
C言語でのネイティブコンパイルのサポート
動作するC言語の開発環境があるとはどういう意味でしょうか?
|
Choosing a GraalVM distribution
Building a native executable requires a GraalVM distribution. There are two main options:
-
Oracle GraalVM — the standard distribution from Oracle. Supports Linux, macOS (both Intel and Apple Silicon), and Windows.
-
Mandrel — a downstream distribution tailored for Quarkus. It excludes components not needed by Quarkus (such as polyglot support) to provide a smaller distribution.
GraalVM for JDK 21 が必要です。
GraalVMの設定
|
このステップは、Linux 以外のオペレーティングシステムをターゲットとしたネイティブ実行可能ファイルを生成する場合にのみ必要です。 Linux をターゲットとしたネイティブ実行可能ファイルを生成する場合は、このセクションを省略して代わりに use a builder image。 |
|
If you cannot install GraalVM, you can use a multi-stage Docker build to run Maven inside a Docker container that embeds GraalVM. There is an explanation of how to do this in the Native Reference Guide. |
-
まだの場合は、GraalVM をインストールします。これにはいくつかのオプションがあります:
-
Download the appropriate archive from https://github.com/graalvm/mandrel/releases or https://www.graalvm.org/downloads/, and unpack it like you would any other JDK.
-
Use platform-specific installer tools like sdkman, homebrew, or scoop. For example, install it with
sdk install java jdk-21.
-
-
ランタイム環境を構成します。
GRAALVM_HOME環境変数をGraalVMインストールディレクトリーに設定します。例えば、export GRAALVM_HOME=$HOME/Development/mandrel/On macOS, point the variable to the
Homesub-directory:export GRAALVM_HOME=$HOME/Development/graalvm/Contents/Home/Windowsでは、コントロールパネルから環境変数を設定する必要があります。
scoop でインストールすれば自動的に設定されます。
-
(オプション) 環境変数
JAVA_HOMEを GraalVM のインストールディレクトリーに設定します。export JAVA_HOME=${GRAALVM_HOME} -
(オプション) GraalVM
binディレクトリーをパスに追加します。export PATH=${GRAALVM_HOME}/bin:$PATH
|
macOS で GraalVM を使用する場合の問題
この GraalVM の issue で報告されているように、GraalVM のバイナリーは macOS 用に (まだ) 公証されていません。そのため、
回避策として、次のコマンドを使用して、GraalVMインストールディレクトリー上の
|
ネイティブ実行可能ファイルの生成
The native executable for your application will contain the application code, required libraries, Java APIs, and a reduced version of a VM. The smaller VM base improves the startup time of the application and produces a minimal disk footprint.

|
For example, to forward the host
All arguments must go into a single ネイティブイメージビルド処理の設定方法については、以下の [設定リファレンス] の項で詳しく説明しています。 |
Native compilation takes significantly longer than a regular JVM build. Create a native executable using:
quarkus build --native
./mvnw install -Dnative
./gradlew build -Dquarkus.native.enabled=true
|
Windows でのパッケージ化に関する問題
Visual Studio の Microsoft Native Tools はパッケージ化する前に初期化する必要があります。
これは、Visual Studio ビルドツールと一緒にインストールされた |
The build produces target/getting-started-1.0.0-SNAPSHOT-runner.
You can run it directly:
./target/getting-started-1.0.0-SNAPSHOT-runner
__ ____ __ _____ ___ __ ____ ______
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
INFO [io.quarkus] (main) getting-started 1.0.0-SNAPSHOT native (powered by Quarkus {quarkus-version}) started in 0.012s. Listening on: http://0.0.0.0:8080
INFO [io.quarkus] (main) Profile prod activated.
INFO [io.quarkus] (main) Installed features: [cdi, rest, smallrye-context-propagation, vertx]
ネイティブ実行可能ファイルのテスト
Producing a native executable can lead to a few issues, and so it’s also a good idea to run some tests against the application running in the native file. The reasoning is explained in the Testing Guide.
GreetingResourceIT がネイティブ実行可能ファイルに対して実行されることを確認するには、 ./mvnw verify -Pnative を使用します。
$ ./mvnw verify -Dnative
...
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.getting.started.GreetingResourceIT
...
INFO [io.quarkus] (main) getting-started 1.0.0-SNAPSHOT native (powered by Quarkus 999-SNAPSHOT) started in 0.012s. Listening on: http://0.0.0.0:8081
INFO [io.quarkus] (main) Profile prod activated.
INFO [io.quarkus] (main) Installed features: [cdi, rest, smallrye-context-propagation, vertx]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
...
|
Quarkus では、デフォルトでネイティブイメージの起動を 60 秒間待機した後、自動的にネイティブテストが失敗します。
この時間は、 |
For advanced testing scenarios, test profiles, excluding tests from native runs, or testing an existing binary, see the Native Reference Guide.
GraalVM をインストールせずに Linux 実行可能ファイルを作成する方法
| 次に進む前に、動作するコンテナーランタイム (Docker、podman) 環境があることを確認してください。Windows で Docker を使用している場合は、Docker Desktop のファイル共有設定でプロジェクトのドライブを共有し、Docker Desktop を再起動する必要があります。 |
多くの場合、Quarkusアプリケーション用のネイティブLinux実行ファイルを作成する必要があります(例えば、コンテナー化された環境で実行するためなど)、このタスクを達成するために適切なGraalVMバージョンをインストールする手間を省きたいと考えています(例えば、CI環境では、できるだけ少ないソフトウェアをインストールするのが一般的です)。
このため、Quarkusでは、Dockerやpodmanなどのコンテナーランタイムを利用して、ネイティブのLinux実行ファイルを作成する非常に便利な方法を提供しています。このタスクを達成する最も簡単な方法は、次を実行することです:
quarkus build --native --no-tests -Dquarkus.native.container-build=true
# The --no-tests flag is required only on Windows and macOS.
./mvnw install -Dnative -DskipTests -Dquarkus.native.container-build=true
./gradlew build -Dquarkus.native.enabled=true -Dquarkus.native.container-build=true
|
What to expect
Your first container-based native build typically takes 3-10 minutes and uses 4-8 GB of RAM on the build host. Fan spin-up is normal; the build is still running, just working hard. A build that runs past 15 minutes without output usually means the container runtime is short on memory; raise its CPU and memory allocation and retry. The output is a Linux binary produced inside the builder image.
Its architecture matches the builder image you pulled: typically |
|
デフォルトでは、Quarkusはコンテナランタイムを自動的に検出します。コンテナランタイムを明示的に選択したい場合は、次のようにします: Docker の場合: コマンドラインインタフェース
Maven
Gradle
podman の場合: コマンドラインインタフェース
Maven
Gradle
これらは通常の Quarkus 設定プロパティーであるため、常にコンテナーでビルドしたい場合は、
毎回指定しなくて済むように |
コンテナーランタイムを使用してそのようにビルドされた実行ファイルは 64 ビット Linux 実行ファイルになるため、お使いのオペレーティングシステムによっては実行できなくなる可能性があります。
|
The builder image used to build the native executable is based on UBI 10.
It means that the native executable produced by the container build will be based on UBI 10 as well.
So, if you plan to build a container, make sure that the base image in your You can configure the builder image used for the container build by setting the
You can see the available tags for UBI 8 here (UBI 8), for UBI 9 here (UBI 9), and for UBI 10 here (UBI 10)) |
|
JARが正常にビルドされているにもかかわらず、コンテナビルドでネイティブ実行可能ファイルを作成しようとすると、アプリケーションJARに対して以下のようなinvalid pathエラーが表示される場合は、コンテナランタイムにリモートデーモンを使用している可能性があります。 Error: Invalid Path entry getting-started-1.0.0-SNAPSHOT-runner.jar Caused by: java.nio.file.NoSuchFileException: /project/getting-started-1.0.0-SNAPSHOT-runner.jar この場合、パラメータ その理由は、 |
|
Mandrel の代わりに GraalVM を使用してビルドする場合は、カスタムビルダーイメージパラメーターを追加で渡す必要があります。 コマンドラインインタフェース
Maven
Gradle
Please note that the above command points to a floating tag. It is highly recommended to use the floating tag, so that your builder image remains up-to-date and secure. If you absolutely must, you may hard-code to a specific tag (see here (UBI 8), here (UBI 9), and here (UBI 10) for available tags), but be aware that you won’t get security updates that way and it’s unsupported. |
コンテナーの作成
コンテナーイメージのエクステンションの使用
Quarkusアプリケーションからコンテナーイメージを作成する最も簡単な方法は、コンテナーイメージ エクステンションの1つを利用することです。
これらのエクステンションのいずれかが存在する場合、ネイティブ実行可能ファイル用のコンテナーイメージを作成することは、基本的には単一のコマンドを実行することになります:
./mvnw package -Dnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true
-
quarkus.native.container-build=trueでは GraalVM がインストールされていなくても Linux の実行ファイルを作成することができます(ローカルに GraalVM がインストールされていない場合や、ローカルのオペレーティングシステムが Linux ではない場合にのみ必要です)。
|
リモートDockerデーモンを実行している場合、 詳細は、Creating a Linux executable without GraalVM installed を参照してください。 |
-
quarkus.container-image.build=true最終的なアプリケーションアーティファクト(この場合はネイティブ実行可能ファイル)を使用してコンテナーイメージを作成するようにQuarkusに指示します。
詳細については、 コンテナイメージガイド を参照してください。
Using the micro base image
You can also build a container manually using the generated Dockerfile.
The project generation provides a Dockerfile.native-micro in the src/main/docker directory with the following content:
FROM quay.io/quarkus/ubi10-quarkus-micro-image:2.0
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root --chmod=755 target/*-runner /work/application
EXPOSE 8080
USER 1001
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
|
Quarkus マイクロイメージとは?
The Quarkus Micro Image is a small container image providing the right set of dependencies to run your native application. It is based on UBI Micro. このページ では、アプリケーションに特定の要件がある場合に、 |
Build and run the container:
docker build -f src/main/docker/Dockerfile.native-micro -t quarkus-quickstart/getting-started .
docker run -i --rm -p 8080:8080 quarkus-quickstart/getting-started
For advanced container options — multi-stage builds, distroless images, scratch images, or UPX compression — see the Native Reference Guide.
ネイティブ実行可能ファイルの設定
ネイティブ実行可能ファイルの生成方法に影響を与える設定オプションがたくさんあります。これらは他の設定プロパティーと同じように application.properties で提供されています。
プロパティーは以下の通りです:
ビルド時に固定される設定プロパティ - 他のすべての設定プロパティは実行時にオーバーライド可能
Configuration property |
タイプ |
デフォルト |
||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Set to enable native-image building using GraalVM. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
Set to enable native-image bundle generation. Environment variable: Show more |
ブーリアン |
|||||||||||||||||||||
Generates the native-image bundle through a dry-run build, skipping the actual native-image build. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
Set to define the native-image bundle name. If not set the default name will match the native-executable’s name suffixed by Environment variable: Show more |
string |
|||||||||||||||||||||
Set to prevent the native-image process from actually building the native image. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
Comma-separated, additional arguments to pass to the build process. If an argument includes the Environment variable: Show more |
文字列のリスト |
|||||||||||||||||||||
Comma-separated, additional arguments to pass to the build process. The arguments are appended to those provided through Environment variable: Show more |
文字列のリスト |
|||||||||||||||||||||
If the HTTP url handler should be enabled, allowing you to do URL.openConnection() for HTTP URLs Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
If the HTTPS url handler should be enabled, allowing you to do URL.openConnection() for HTTPS URLs Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
The default value for java.awt.headless JVM option. Switching this option affects linking of awt libraries. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
Defines the file encoding as in Native image runtime uses the host’s (i.e. build time) value of Environment variable: Show more |
string |
|
||||||||||||||||||||
If all character sets should be added to the native executable. Note that some extensions (e.g. the Oracle JDBC driver) also take this setting into account to enable support for all charsets at the extension level. This increases image size. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
The location of the Graal distribution Environment variable: Show more |
string |
|
||||||||||||||||||||
The location of the JDK Environment variable: Show more |
|
|||||||||||||||||||||
The maximum Java heap to be used during the native image generation Environment variable: Show more |
string |
|||||||||||||||||||||
If the native image build should wait for a debugger to be attached before running. This is an advanced option and is generally only intended for those familiar with GraalVM internals Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
If the debug port should be published when building with docker and debug-build-process is true Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
If isolates should be enabled Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
If a JVM based 'fallback image' should be created if native image fails. This is not recommended, as this is functionally the same as just running the application in a JVM Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
If all META-INF/services entries should be automatically registered Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
If the bytecode of all proxies should be dumped for inspection Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
If this build should be done using a container runtime. Unless container-runtime is also set, docker will be used by default. If docker is not available or is an alias to podman, podman will be used instead as the default. Environment variable: Show more |
ブーリアン |
|||||||||||||||||||||
Explicit configuration option to generate a native Position Independent Executable (PIE) for Linux. If the system supports PIE generation, the default behaviour is to disable it for performance reasons. However, some systems can only run position-independent executables, so this option enables the generation of such native executables. Environment variable: Show more |
ブーリアン |
|||||||||||||||||||||
Generate instructions for a specific machine type. Defaults to Environment variable: Show more |
string |
|||||||||||||||||||||
If this build is done using a remote docker daemon. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
The docker image to use to do the image build. It can be one of Note: Builder images are available using UBI 8, UBI 9, and UBI 10 base images, for example:
You need to be aware that if you use a builder image using UBI 10 and you plan to build a container, you must ensure that the base image used in the container is also UBI 10. Environment variable: Show more |
string |
|
||||||||||||||||||||
The strategy for pulling the builder image during the build. Defaults to 'always', which will always pull the most up-to-date image; useful to keep up with fixes when a (floating) tag is updated. Use 'missing' to only pull if there is no image locally; useful on development environments where building with out-of-date images is acceptable and bandwidth may be limited. Use 'never' to fail the build if there is no image locally. Environment variable: Show more |
|
|
||||||||||||||||||||
The container runtime (e.g. docker) that is used to do an image based build. If this is set then a container build is always done. Environment variable: Show more |
|
|||||||||||||||||||||
Options to pass to the container runtime Environment variable: Show more |
文字列のリスト |
|||||||||||||||||||||
This property is deprecated: Use If the resulting image should allow VM introspection. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
Enable monitoring various monitoring options. The value should be comma separated.
Environment variable: Show more |
list of |
|||||||||||||||||||||
If the reports on call paths and included packages/classes/methods should be generated Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
If exceptions should be reported with a full stack trace Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
If errors should be reported at runtime. This is a more relaxed setting, however it is not recommended as it means your application may fail at runtime if an unsupported feature is used by accident. Note that the use of this flag may result in build time failures due to `ClassNotFoundException`s. Reason most likely being that the Quarkus extension already optimized it away or do not actually need it. In such cases you should explicitly add the corresponding dependency providing the missing classes as a dependency to your project. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
Don’t build a native image if it already exists. This is useful if you have already built an image and you want to use Quarkus to deploy it somewhere. Note that this is not able to detect if the existing image is outdated, if you have modified source or config and want a new image you must not use this flag. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
A comma separated list of globs to match resource paths that should be added to the native image. Use slash ( By default, no resources are included. Example: Given that you have
the files Supported glob features
Note that there are three levels of escaping when passing this option via
All three levels use backslash ( Note that Quarkus extensions typically include the resources they require by themselves. This option is useful in situations when the built-in functionality is not sufficient. Environment variable: Show more |
文字列のリスト |
|||||||||||||||||||||
This property is deprecated since A comma separated list of globs to match resource paths that should not be added to the native image. Use slash ( Please refer to By default, no resources are excluded. Example: Given that you have
the resource Environment variable: Show more |
文字列のリスト |
|||||||||||||||||||||
If debug is enabled and debug symbols are generated. The symbols will be generated in a separate .debug file. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
Generate the report files for GraalVM Dashboard. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
Include a reasons entries in the generated json configuration files. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
Whether compression should be enabled. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
Whether the compression should be executed within a container. Environment variable: Show more |
ブーリアン |
|||||||||||||||||||||
The image used for compression. Defaults to Setting this variable will automatically activate Environment variable: Show more |
string |
|||||||||||||||||||||
The compression level in [1, 10]. 10 means best. Higher compression level requires more time to compress the executable. Environment variable: Show more |
int |
|||||||||||||||||||||
Allows passing extra arguments to the UPX command line (like --brute). The arguments are comma-separated. The exhaustive list of parameters can be found in https://github.com/upx/upx/blob/devel/doc/upx.pod. Environment variable: Show more |
文字列のリスト |
|||||||||||||||||||||
Configuration files generated by the Quarkus build, using native image agent, are informative by default. In other words, the generated configuration files are presented in the build log but are not applied. When this option is set to true, generated configuration files are applied to the native executable building process. Enabling this option should be done with care, because it can make native image configuration and/or behaviour dependant on other non-obvious factors. For example, if the native image agent generated configuration was generated from running JVM unit tests, disabling test(s) can result in a different native image configuration being generated, which in turn can misconfigure the native executable or affect its behaviour in unintended ways. Environment variable: Show more |
ブーリアン |
|
||||||||||||||||||||
Enable Profile-Guided Optimization for native images. Requires Oracle GraalVM. When enabled, the native build produces an instrumented binary. Running Environment variable: Show more |
ブーリアン |
|
次のステップ
This guide covered the creation of a native (binary) executable for your application. It provides an application exhibiting a swift startup time and consuming less memory.
-
Native Reference Guide — advanced topics: memory management, debugging, monitoring, testing profiles, and more
-
Container Image Guide — Jib, Docker, and Buildpack integrations