Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quarkus/jib: Native build fails if docker isn't installed #24231

Closed
jesperpedersen opened this issue Mar 10, 2022 · 9 comments · Fixed by #24238
Closed

quarkus/jib: Native build fails if docker isn't installed #24231

jesperpedersen opened this issue Mar 10, 2022 · 9 comments · Fixed by #24238
Assignees
Labels
area/container-image kind/bug Something isn't working
Milestone

Comments

@jesperpedersen
Copy link

Describe the bug

  1. Download https://github.com/operator-framework/operator-sdk
  2. mkdir test && cd test
  3. operator-sdk init --plugins quarkus --domain halkyon.io --project-name expose
  4. Change pom.xml
    <quarkus-sdk.version>3.0.4</quarkus-sdk.version>
    <quarkus.version>2.7.3.Final</quarkus.version>
  1. mvn clean package -Pnative

Fails with

[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:2.7.3.Final:build (default) on project expose: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] 	[error]: Build step io.quarkus.container.image.jib.deployment.JibProcessor#buildFromNative threw an exception: java.lang.RuntimeException: Unable to create container image
[ERROR] 	at io.quarkus.container.image.jib.deployment.JibProcessor.containerize(JibProcessor.java:236)
[ERROR] 	at io.quarkus.container.image.jib.deployment.JibProcessor.buildFromNative(JibProcessor.java:203)
[ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] 	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[ERROR] 	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:882)
[ERROR] 	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR] 	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR] 	at java.base/java.lang.Thread.run(Thread.java:832)
[ERROR] 	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Cannot run program "docker": error=2, No such file or directory
[ERROR] 	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:566)
[ERROR] 	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:547)
[ERROR] 	at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:88)
[ERROR] 	at com.google.cloud.tools.jib.builder.steps.StepsRunner.run(StepsRunner.java:219)
[ERROR] 	at com.google.cloud.tools.jib.api.Containerizer.run(Containerizer.java:390)
[ERROR] 	at com.google.cloud.tools.jib.api.JibContainerBuilder.containerize(JibContainerBuilder.java:598)
[ERROR] 	at io.quarkus.container.image.jib.deployment.JibProcessor.containerize(JibProcessor.java:229)
[ERROR] 	... 12 more
[ERROR] Caused by: java.io.IOException: Cannot run program "docker": error=2, No such file or directory
[ERROR] 	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
[ERROR] 	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
[ERROR] 	at com.google.cloud.tools.jib.docker.DockerClient.docker(DockerClient.java:277)
[ERROR] 	at com.google.cloud.tools.jib.docker.DockerClient.load(DockerClient.java:193)
[ERROR] 	at com.google.cloud.tools.jib.builder.steps.LoadDockerStep.call(LoadDockerStep.java:74)
[ERROR] 	at com.google.cloud.tools.jib.builder.steps.StepsRunner.lambda$loadDocker$18(StepsRunner.java:618)
[ERROR] 	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
[ERROR] 	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
[ERROR] 	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
[ERROR] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[ERROR] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[ERROR] 	at java.base/java.lang.Thread.run(Thread.java:832)
[ERROR] Caused by: java.io.IOException: error=2, No such file or directory
[ERROR] 	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
[ERROR] 	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:319)
[ERROR] 	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:250)
[ERROR] 	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
[ERROR] 	... 11 more

since docker isn't installed. The build up to this point have used podman successfully.

Expected behavior

To be able to use podman for the entire build

Actual behavior

docker is required - e.g. podman isn't detected

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

JDK14

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.7.3.Final

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

Maven 3.8.4

Additional information

Workaround: Using

mvn clean package -Dquarkus.docker.executable-name=podman -Pnative

and the build is successful.

Code: extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java

@jesperpedersen jesperpedersen added the kind/bug Something isn't working label Mar 10, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 10, 2022

/cc @geoand

@geoand
Copy link
Contributor

geoand commented Mar 10, 2022

What you are seeing is the expected behavior.

since docker isn't installed. The build up to this point have used podman successfully.

I assume you mean with this that building the native binary is done with podman without you having to configure anything?

@geoand geoand self-assigned this Mar 10, 2022
@jesperpedersen
Copy link
Author

@geoand Correct - like

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner] Using podman to run the native image builder

@jesperpedersen
Copy link
Author

@metacosm FYI

@geoand
Copy link
Contributor

geoand commented Mar 10, 2022

Gotcha, thanks .

I'll bring it in line with what we do for the native build

geoand added a commit to geoand/quarkus that referenced this issue Mar 10, 2022
The detection uses the same method Quarkus already
used when building the native binary using a container build

Fixes: quarkusio#24231
geoand added a commit that referenced this issue Mar 11, 2022
Detect container runtime when using Jib
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Mar 11, 2022
@jesperpedersen
Copy link
Author

Thank you for your quick fix !

gsmet pushed a commit to gsmet/quarkus that referenced this issue Mar 14, 2022
The detection uses the same method Quarkus already
used when building the native binary using a container build

Fixes: quarkusio#24231
(cherry picked from commit a6745e0)
@gsmet
Copy link
Member

gsmet commented Mar 16, 2022

@jesperpedersen 2.7.5.Final has been released.

@jesperpedersen
Copy link
Author

@gsmet w00t!
@metacosm ^

@metacosm
Copy link
Contributor

Already? Damn, I barely had time to release the extension with 2.7.4! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/container-image kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants