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

I can't seem to be able to build native images in docker via minikube #5133

Closed
emmanuelbernard opened this issue Nov 3, 2019 · 7 comments
Closed
Labels
kind/bug Something isn't working

Comments

@emmanuelbernard
Copy link
Member

$> ./mvnw package -Pnative -Dquarkus.native.container-build=true
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.example:fruits-app >-----------------------
[INFO] Building fruits-app 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ fruits-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ fruits-app ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ fruits-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/emmanuel/Code/quarkus/demos/kamesh/quarkus-tutorial/work/fruits-app/fruits-app/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ fruits-app ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ fruits-app ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.example.FruitResourceTest
2019-11-03 09:31:33,768 INFO [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation
2019-11-03 09:31:34,389 INFO [io.qua.resteasy] (build-17) Resteasy running without servlet container.
2019-11-03 09:31:34,389 INFO [io.qua.resteasy] (build-17) - Add quarkus-undertow to run Resteasy within a servlet container
2019-11-03 09:31:34,429 INFO [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 661ms
2019-11-03 09:31:34,846 INFO [io.quarkus] (main) Quarkus 0.27.0 started in 0.391s. Listening on: http://0.0.0.0:8081
2019-11-03 09:31:34,847 INFO [io.quarkus] (main) Profile test activated.
2019-11-03 09:31:34,847 INFO [io.quarkus] (main) Installed features: [cdi, resteasy]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.024 s - in com.example.FruitResourceTest
2019-11-03 09:31:35,900 INFO [io.quarkus] (main) Quarkus stopped in 0.028s
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ fruits-app ---
[INFO]
[INFO] --- quarkus-maven-plugin:0.27.0:build (default) @ fruits-app ---
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Beginning quarkus augmentation
[INFO] [org.jboss.threads] JBoss Threads version 3.0.0.Final
[INFO] [io.quarkus.resteasy] Resteasy running without servlet container.
[INFO] [io.quarkus.resteasy] - Add quarkus-undertow to run Resteasy within a servlet container
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /Users/emmanuel/Code/quarkus/demos/kamesh/quarkus-tutorial/work/fruits-app/fruits-app/target/fruits-app-1.0-SNAPSHOT-native-image-source-jar/fruits-app-1.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /Users/emmanuel/Code/quarkus/demos/kamesh/quarkus-tutorial/work/fruits-app/fruits-app/target/fruits-app-1.0-SNAPSHOT-native-image-source-jar/fruits-app-1.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on OpenJDK 64-Bit GraalVM CE 19.2.1
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v /Users/emmanuel/Code/quarkus/demos/kamesh/quarkus-tutorial/work/fruits-app/fruits-app/target/fruits-app-1.0-SNAPSHOT-native-image-source-jar:/project:z --rm quay.io/quarkus/ubi-quarkus-native-image:19.2.1 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar fruits-app-1.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:-JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace fruits-app-1.0-SNAPSHOT-runner
Error: Invalid Path entry fruits-app-1.0-SNAPSHOT-runner.jar
Caused by: java.nio.file.NoSuchFileException: /project/fruits-app-1.0-SNAPSHOT-runner.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.092 s
[INFO] Finished at: 2019-11-03T09:31:38+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.27.0:build (default) on project fruits-app: Failed to build a runnable JAR: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:294)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:941)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR] at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR] at java.lang.Thread.run(Thread.java:748)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.lang.RuntimeException: Image generation failed
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:283)
[ERROR] ... 12 more
[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
 

@emmanuelbernard
Copy link
Member Author

I tracked it down to minikube having been started and overriding docker host

declare -x DOCKER_CERT_PATH="/Users/emmanuel/.minikube/certs"
declare -x DOCKER_HOST="tcp://192.168.64.7:2376"
declare -x DOCKER_TLS_VERIFY="1"

@cescoffier I let you decide if that's a bug or not and a 0.28.0 or not.

@emmanuelbernard emmanuelbernard added this to the 0.28.0 milestone Nov 3, 2019
@emmanuelbernard emmanuelbernard added the kind/bug Something isn't working label Nov 3, 2019
@emmanuelbernard
Copy link
Member Author

I confirm that when running minikube version: v1.5.2
commit: 792dbf92a1de583fcee76f8791cff12e0c9440ad

I reproduce that error

Specifically

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v /Users/emmanuel/Code/quarkus/demos/kamesh/quarkus-tutorial/work/fruits-app/target/fruits-app-1.0-SNAPSHOT-native-image-source-jar:/project:z --rm quay.io/quarkus/ubi-quarkus-native-image:19.2.1 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogMa
nager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar fruits-app-1.0-SNAPSHOT-r
unner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:-JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace fruits-app-1.0-SNAPSHOT-runner
Error: Invalid Path entry fruits-app-1.0-SNAPSHOT-runner.jar
Caused by: java.nio.file.NoSuchFileException: /project/fruits-app-1.0-SNAPSHOT-runner.jar

@emmanuelbernard emmanuelbernard changed the title I can't seem to be able to build native images in docker I can't seem to be able to build native images in docker via minikube Nov 3, 2019
@emmanuelbernard
Copy link
Member Author

So it's a known minikube issue as it cannot deal with volumes

@emmanuelbernard emmanuelbernard removed this from the 0.28.0 milestone Nov 3, 2019
@nfrankel
Copy link

Hello!

Just hit this too... Any way to overcome that while keeping minikube?

@cescoffier
Copy link
Member

So, there is a sneaky way. It consists of using 2 terminals.

In the first terminal, use your local docker, and run the quarkus build to generate the Linux 64 bits executable:

# Terminal 1
mvn package -Pnative -Dquarkus.native.container-build=true

In the second terminal, do the docker socket switch to use the minikube docker host:

# Terminal 2
eval $(minikube docker-env)

Then, issue the docker build from this terminal:

# Terminal 2
docker build -f src/main/docker/Dockerfile.native -t quarkus-quickstart/getting-started .

This creates the Docker image in the image registry from minikube. So you can, then, create your deployments/pods.

@jclingan
Copy link

Is it possible to find a solution starting with Minikube 1.13 - Support for mounting host volumes on start with docker driver?

@geoand
Copy link
Contributor

geoand commented Feb 26, 2024

Closing as out of date.

Let's open a new issue if this is still a problem with the latest version of Quarkus and Minikube

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants