quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.82k stars 2.69k forks source link

quarkus-container-image-docker 3.8.5 doesnt see docker allias #41475

Closed michalsomora closed 1 month ago

michalsomora commented 4 months ago

Describe the bug

When building docker image of quarkus project with maven command quarkus-container-image-docker fails due to missing docker command although docker is available from command line

maven command is executed in windows, docker is installed in wsl2 and docker command is available via allias docker=wsl.exe docker

docker --version Docker version 25.0.3, build 4debf41

For some reason docker command is not available for jre via alias. Command fails in class io.quarkus.deployment.util.ContainerRuntimeUtil:222 getVersionOutputFor when it tries to execute docker --version with error java.io.IOException: Cannot run program "podman": CreateProcess error=2, The system cannot find the file specified

Executing quarkus integration tests with mockserver works without problem although docker is requered there as well.

Expected behavior

Docker image is built successfully

Actual behavior

[INFO] Found Docker environment with Environment variables, system properties and defaults. Resolved dockerHost=tcp://172.30.100.49:2375
[INFO] Docker host IP address is 172.30.100.49
[INFO] Connected to docker:
  Server Version: 25.0.3
  API Version: 1.44
  Operating System: Ubuntu 20.04.6 LTS
  Total Memory: 15998 MB
[INFO] Image pull policy will be performed by: DefaultPullPolicy()
[INFO] Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
[INFO] Checking the system...
[INFO] ?? Docker server version should be at least 1.6.0
[INFO] [io.quarkus.container.image.docker.deployment.DockerProcessor] Starting (local) container image build for jar using docker.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:20 min
[INFO] Finished at: 2024-06-26T16:29:30+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:3.8.5:build (default) on project myproject: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.container.image.docker.deployment.DockerProcessor#dockerBuildFromJar threw an exception: java.lang.IllegalStateException: No container runtime was found. Make sure you have either Docker or Podman installed in your environment.
[ERROR]         at io.quarkus.deployment.util.ContainerRuntimeUtil.detectContainerRuntime(ContainerRuntimeUtil.java:58)
[ERROR]         at io.quarkus.container.image.docker.deployment.DockerProcessor.createContainerImage(DockerProcessor.java:193)
[ERROR]         at io.quarkus.container.image.docker.deployment.DockerProcessor.dockerBuildFromJar(DockerProcessor.java:103)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:833)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

How to Reproduce?

run mvn clean install on quarkus project with extension quarkus-container-image-docker and having docker only in wsl linked to windows via DOCKER_HOST env variable

Output of uname -a or ver

No response

Output of java -version

java version "17.0.8" 2023-07-18 LTS Java(TM) SE Runtime Environment (build 17.0.8+9-LTS-211) Java HotSpot(TM) 64-Bit Server VM (build 17.0.8+9-LTS-211, mixed mode, sharing)

Quarkus version or git rev

3.8.5

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

Apache Maven 3.9.1

Additional information

No response

geoand commented 1 month ago

Is this still an issue with the latest versions of Quarkus?

geoand commented 1 month ago

Closing for lack of feedback