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

Buildpack extension not working with podman #41899

Closed
matzew opened this issue Jul 15, 2024 · 6 comments · Fixed by #41936
Closed

Buildpack extension not working with podman #41899

matzew opened this issue Jul 15, 2024 · 6 comments · Fixed by #41936
Labels
env/podman kind/bug Something isn't working
Milestone

Comments

@matzew
Copy link

matzew commented Jul 15, 2024

Describe the bug

The buildpack extension seems to not work with podman, as I am getting:

[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.12.2:build (default) on project code-with-quarkus: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] 	[error]: Build step io.quarkus.container.image.buildpack.deployment.BuildpackProcessor#buildFromJar threw an exception: java.lang.RuntimeException: java.io.IOException: com.sun.jna.LastErrorException: [2] No such file or directory
[ERROR] 	at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:210)
[ERROR] 	at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:9)
[ERROR] 	at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
[ERROR] 	at com.github.dockerjava.core.DefaultInvocationBuilder.get(DefaultInvocationBuilder.java:202)
[ERROR] 	at com.github.dockerjava.core.DefaultInvocationBuilder.get(DefaultInvocationBuilder.java:74)
[ERROR] 	at com.github.dockerjava.core.exec.ListImagesCmdExec.execute(ListImagesCmdExec.java:41)
[ERROR] 	at com.github.dockerjava.core.exec.ListImagesCmdExec.execute(ListImagesCmdExec.java:16)
[ERROR] 	at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
[ERROR] 	at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
[ERROR] 	at dev.snowdrop.buildpack.docker.ImageUtils.pullImages(ImageUtils.java:39)
[ERROR] 	at dev.snowdrop.buildpack.Buildpack.prep(Buildpack.java:220)
[ERROR] 	at dev.snowdrop.buildpack.Buildpack.build(Buildpack.java:104)
[ERROR] 	at dev.snowdrop.buildpack.Buildpack.<init>(Buildpack.java:98)
[ERROR] 	at dev.snowdrop.buildpack.EditableBuildpack.<init>(EditableBuildpack.java:16)
[ERROR] 	at dev.snowdrop.buildpack.BuildpackBuilder.build(BuildpackBuilder.java:72)
[ERROR] 	at io.quarkus.container.image.buildpack.deployment.BuildpackProcessor.runBuildpackBuild(BuildpackProcessor.java:208)
[ERROR] 	at io.quarkus.container.image.buildpack.deployment.BuildpackProcessor.buildFromJar(BuildpackProcessor.java:89)
[ERROR] 	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
[ERROR] 	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[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.doRunWith(EnhancedQueueExecutor.java:2516)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
[ERROR] 	at java.base/java.lang.Thread.run(Thread.java:1570)
[ERROR] 	at org.jboss.threads.JBossThread.run(JBossThread.java:483)
[ERROR] Caused by: java.io.IOException: com.sun.jna.LastErrorException: [2] No such file or directory
[ERROR] 	at com.github.dockerjava.transport.DomainSocket.<init>(DomainSocket.java:63)
[ERROR] 	at com.github.dockerjava.transport.LinuxDomainSocket.<init>(LinuxDomainSocket.java:41)
[ERROR] 	at com.github.dockerjava.transport.DomainSocket.get(DomainSocket.java:140)
[ERROR] 	at com.github.dockerjava.transport.UnixSocket.get(UnixSocket.java:29)
[ERROR] 	at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl$2.createSocket(ApacheDockerHttpClientImpl.java:154)
[ERROR] 	at org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:125)
[ERROR] 	at org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:409)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:164)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:174)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:135)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:172)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:93)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:128)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:178)
[ERROR] 	at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:67)
[ERROR] 	at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:206)
[ERROR] 	... 26 more
[ERROR] Caused by: com.sun.jna.LastErrorException: [2] No such file or directory
[ERROR] 	at com.github.dockerjava.transport.LinuxDomainSocket.connect(Native Method)
[ERROR] 	at com.github.dockerjava.transport.LinuxDomainSocket.connect(LinuxDomainSocket.java:49)
[ERROR] 	at com.github.dockerjava.transport.DomainSocket.open(DomainSocket.java:69)
[ERROR] 	at com.github.dockerjava.transport.DomainSocket.<init>(DomainSocket.java:59)
[ERROR] 	... 51 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

Expected behavior

Works with Podman 😄

Actual behavior

Unable to build like:

./mvnw package -Dquarkus.container-image.build=true 

as it gives the above error

How to Reproduce?

I created a new empty project, from this page: https://quarkus.io/extensions/io.quarkus/quarkus-container-image-buildpack/?tab=docs

TRY THIS EXTENSION,

After unzipping the bundle, I ran:

./mvnw package -Dquarkus.container-image.build=true 

which fails

Output of uname -a or ver

Linux fedora 6.9.6-200.fc40.x86_64

Output of java -version

java --version openjdk 21.0.3 2024-04-16 OpenJDK Runtime Environment (Red_Hat-21.0.3.0.9-1) (build 21.0.3+9) OpenJDK 64-Bit Server VM (Red_Hat-21.0.3.0.9-1) (build 21.0.3+9, mixed mode, sharing)

Quarkus version or git rev

No response

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

No response

Additional information

Output from podman info:

host:
  arch: amd64
  buildahVersion: 1.36.0
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.10-1.fc40.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.10, commit: '
  cpuUtilization:
    idlePercent: 97.92
    systemPercent: 0.42
    userPercent: 1.66
  cpus: 16
  databaseBackend: boltdb
  distribution:
    distribution: fedora
    variant: workstation
    version: "40"
  eventLogger: journald
  freeLocks: 1833
  hostname: fedora
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.9.6-200.fc40.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 39467360256
  memTotal: 67107102720
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.11.0-1.fc40.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.11.0
    package: netavark-1.11.0-1.fc40.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.11.0
  ociRuntime:
    name: crun
    package: crun-1.15-1.fc40.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.15
      commit: e6eacaf4034e84185fd8780ac9262bbf57082278
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20240624.g1ee2eca-1.fc40.x86_64
    version: |
      pasta 0^20240624.g1ee2eca-1.fc40.x86_64
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  rootlessNetworkCmd: pasta
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.2-2.fc40.x86_64
    version: |-
      slirp4netns version 1.2.2
      commit: 0ee2d87523e906518d34a6b423271e4826f71faf
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.5
  swapFree: 8589930496
  swapTotal: 8589930496
  uptime: 72h 7m 26.00s (Approximately 3.00 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  127.0.0.1:5001:
    Blocked: false
    Insecure: true
    Location: 127.0.0.1:5001
    MirrorByDigestOnly: false
    Mirrors: null
    Prefix: 127.0.0.1:5001
    PullFromMirror: ""
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /home/matzew/.config/containers/storage.conf
  containerStore:
    number: 29
    paused: 0
    running: 0
    stopped: 29
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/matzew/.local/share/containers/storage
  graphRootAllocated: 1022505254912
  graphRootUsed: 358288756736
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 922
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/matzew/.local/share/containers/storage/volumes
version:
  APIVersion: 5.1.1
  Built: 1717459200
  BuiltTime: Tue Jun  4 02:00:00 2024
  GitCommit: ""
  GoVersion: go1.22.3
  Os: linux
  OsArch: linux/amd64
  Version: 5.1.1

@matzew matzew added the kind/bug Something isn't working label Jul 15, 2024
Copy link

quarkus-bot bot commented Jul 15, 2024

/cc @maxandersen (podman)

@matzew
Copy link
Author

matzew commented Jul 15, 2024

using the jib extension (just to test things) it works

[INFO] [io.quarkus.container.image.jib.deployment.JibProcessor] Starting (local) container image build for jar using jib.
[INFO] [io.quarkus.container.image.jib.deployment.JibProcessor] Using podman to run the native image builder
[WARNING] [io.quarkus.container.image.jib.deployment.JibProcessor] Base image 'registry.access.redhat.com/ubi8/openjdk-17-runtime:1.19' does not use a specific image digest - build may not be reproducible
[INFO] [io.quarkus.container.image.jib.deployment.JibProcessor] Using base image with digest: sha256:1431c7b8b4ebe450d2ad67029b0310c93ca878224ac0917818ea93ba50411cba
[INFO] [io.quarkus.container.image.jib.deployment.JibProcessor] Container entrypoint set to [/opt/jboss/container/java/run/run-java.sh]
[INFO] [io.quarkus.container.image.jib.deployment.JibProcessor] Created container image matzew/code-with-quarkus:1.0.0-SNAPSHOT (sha256:8d101da2b0e645ae7943bd9a93e89cccbccce68107df5f97bdc647f4c7bcf6a3)

@matzew
Copy link
Author

matzew commented Jul 15, 2024

A little update, for shake of podman versus pack, I did:

sudo ln -s /tmp/docker.sock /var/run/docker.sock

and added this to my application.properties file:

quarkus.container-image.group=matzew
quarkus.container-image.registry=docker.io
quarkus.buildpack.jvm-builder-image=ghcr.io/knative/builder-jammy-tiny:0.0.264

but that gave me this error:

[INFO] --- quarkus:3.12.2:build (default) @ code-with-quarkus ---
[INFO] [io.quarkus.container.image.buildpack.deployment.BuildpackProcessor] Starting (local) container image build for jar using buildpack.
[INFO] [io.quarkus.container.image.buildpack.deployment.BuildpackProcessor] Initiating Buildpack build
[INFO] Buildpack build invoked, preparing environment...
[INFO] Build configured with..
[INFO] - build image : ghcr.io/knative/builder-jammy-tiny:0.0.264
[INFO] - run image : docker.io/paketobuildpacks/run-jammy-tiny:latest
[INFO] - build volumes created
[INFO] - mounted buildpack-build-oiersjufwe at /bld
[INFO] - mounted buildpack-launch-sirggszdos at /launch
[INFO] - mounted buildpack-app-jusszllipt at /app
[INFO] - mounted buildpack-platform-exgygnspwo at /platform
[INFO] - mounted /var/run/docker.sock at /var/run/docker.sock
[INFO] - mounted buildpack-output-bwkldalkge at /out
[INFO] - build container id 3f1266c3d86420b3624bf620f0f89c6b50778fcbd6624e14c9e0415bf9efdd22
[INFO] - uploaded archive to container at /app/content
[INFO] - uploaded env to container at /platform/env
[INFO] - launching build container
[INFO] - attaching log relay
ERROR: failed to set platform API: platform API version '0.4' is incompatible with the lifecycle
[INFO] Buildpack build complete, with exit code 11
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.703 s
[INFO] Finished at: 2024-07-15T16:29:53+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.12.2:build (default) on project code-with-quarkus: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] 	[error]: Build step io.quarkus.container.image.buildpack.deployment.BuildpackProcessor#buildFromJar threw an exception: java.lang.IllegalStateException: Buildpack build failed
[ERROR] 	at io.quarkus.container.image.buildpack.deployment.BuildpackProcessor.runBuildpackBuild(BuildpackProcessor.java:211)
[ERROR] 	at io.quarkus.container.image.buildpack.deployment.BuildpackProcessor.buildFromJar(BuildpackProcessor.java:89)
[ERROR] 	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
[ERROR] 	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[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.doRunWith(EnhancedQueueExecutor.java:2516)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
[ERROR] 	at java.base/java.lang.Thread.run(Thread.java:1570)
[ERROR] 	at org.jboss.threads.JBossThread.run(JBossThread.java:483)
[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] 

CC @BarDweller

@matejvasek
Copy link
Contributor

quarkus.buildpack.jvm-builder-image=ghcr.io/knative/builder-jammy-tiny:0.0.264

That is probably not necessary the default builder works a little bit better by which I mean it fails little bit latter.

@matejvasek
Copy link
Contributor

It appears that property quarkus.buildpack.docker-host can be used to configure the socket, however it's not documented and it still should honor DOCKER_HOST but it does not do that.

@BarDweller
Copy link
Contributor

The current buildpack implementation in quarkus will not work with podman.. The new release of the snowdrop buildpack library addresses some podman compatibility issues, and has been tested with podman and docker daemons.

I'll tag this Issue when I raise the PR to update quarkus to the new library revision. Should be within a few days.

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

Successfully merging a pull request may close this issue.

3 participants