diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java index b559b52dc487d..c06f33e9f4473 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java @@ -82,7 +82,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa // E.g. "/usr/bin/docker run -v {{PROJECT_DIR}}:/project --rm quarkus/graalvm-native-image" nativeImage = new ArrayList<>(); Collections.addAll(nativeImage, nativeConfig.containerRuntime, "run", "-v", - outputDir.toAbsolutePath() + ":/project:z", "--rm"); + outputDir.toAbsolutePath() + ":/project:z"); if (IS_LINUX) { if ("docker".equals(nativeConfig.containerRuntime)) { @@ -101,7 +101,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa // publish the debug port onto the host if asked for nativeImage.add("--publish=" + DEBUG_BUILD_PROCESS_PORT + ":" + DEBUG_BUILD_PROCESS_PORT); } - nativeImage.add(nativeConfig.builderImage); + Collections.addAll(nativeImage, "--rm", nativeConfig.builderImage); } else { if (IS_LINUX) { noPIE = detectNoPIE();