Repository: quarkusio/quarkus
Issue: Native awt build fails on Windows also when running with native-build-container

### Describe the bug

Running the native build with `-Dquarkus.native.container-build=true` also fails on windows even though the native-build would be executed inside a linux docker container.

### Expected behavior

The build should work inside a linux docker container

### Actual behavior

Following error is thrown:

```
* What went wrong:
Execution failed for task ':devtools:machine-learning:labeling-server:quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
  	[error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
  	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:281)
  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
  	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
  	at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
  	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
  	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
  	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
  	at java.base/java.lang.Thread.run(Thread.java:833)
  	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
  Caused by: java.lang.UnsupportedOperationException: Windows AWT integration is not ready in native-image and would result in java.lang.UnsatisfiedLinkError: no awt in java.library.path.
  	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep$NativeImageInvokerInfo$Builder.build(NativeImageBuildStep.java:883)
  	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:249)
  	... 11 more
```

### How to Reproduce?

* add `io.quarkus:quarkus-awt`
* run
```sh
gradlew quarkusBuild -Dquarkus.native.container-build=true -Dquarkus.package.type=native -Dquarkus.container-image.build=true
```

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

17

### GraalVM version (if different from Java)

17

### Quarkus version or git rev

2.13.0.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

gradlew 7.5.1

### Additional information

_No response_

Changed files:
core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/UnsupportedOSBuildItem.java

diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/UnsupportedOSBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/UnsupportedOSBuildItem.java
index 04ba9d9ab52..159e406ecef 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/UnsupportedOSBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/UnsupportedOSBuildItem.java
@@ -5,6 +5,7 @@
 import static io.quarkus.dev.console.QuarkusConsole.IS_WINDOWS;
 
 import io.quarkus.builder.item.MultiBuildItem;
+import io.quarkus.deployment.pkg.NativeConfig;
 
 /**
  * Native-image might not be supported for a particular
@@ -30,4 +31,15 @@ public UnsupportedOSBuildItem(Os os, String error) {
         this.os = os;
         this.error = error;
     }
+
+    public boolean triggerError(NativeConfig nativeConfig) {
+        return
+        // When the host OS is unsupported, it could have helped to
+        // run in a Linux builder image (e.g. an extension unsupported on Windows).
+        (os.active && !nativeConfig.isContainerBuild()) ||
+        // If Linux is the OS the extension does not support,
+        // it fails in a container build regardless the host OS,
+        // because we have only Linux based builder images.
+                (nativeConfig.isContainerBuild() && os == Os.LINUX);
+    }
 }
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 be61fb022f7..dbedfb8aee9 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
@@ -891,7 +891,9 @@ public NativeImageInvokerInfo build() {
                 }
 
                 if (unsupportedOSes != null && !unsupportedOSes.isEmpty()) {
-                    final String errs = unsupportedOSes.stream().filter(o -> o.os.active).map(o -> o.error)
+                    final String errs = unsupportedOSes.stream()
+                            .filter(o -> o.triggerError(nativeConfig))
+                            .map(o -> o.error)
                             .collect(Collectors.joining(", "));
                     if (!errs.isEmpty()) {
                         throw new UnsupportedOperationException(errs);