Problem I cannot build a docker image using bootBuildImage. I have configured the task according to the documentation:

tasks.withType<org.springframework.boot.gradle.tasks.bundling.BootBuildImage> {
    docker {
        host= "unix://${System.getenv("XDG_RUNTIME_DIR")}/podman/podman.sock"
        bindHostToBuilder.set(true)
    }
}

This results in the following error:

> Connection to the Docker daemon at '/run/user/1001/podman/podman.sock' failed with error "[2] No such file or directory"; ensure the Docker daemon is running and accessible

Podman is working fine I can run the following command: podman ps with no error and start containers.

When building with docker runtime I have no issue.

Versions Spring Boot Version: 3.2.4 Podman Version: 4.3.1 Operating System: Ubuntu 23.10
Kernel: Linux 6.5.0-26-generic Architecture: x86-64 Hardware Vendor: Dell Inc.

Comment From: mhalbritter

When you run podman info, it should print out the path to your socket:

remoteSocket:
    exists: false
    path: /run/user/1000/podman/podman.sock

On my machine, by default, the socket is not there, as the systemd podman unit is not running. Start it with systemctl --user start podman, and the socket appears:

  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock

Does that help?

Comment From: ghilainm

@mhalbritter according to my understanding it should be started automatically when invoked. But I am not an expert in the domain.

If this is a pre-requisite to start Podman service manually, it could be useful to document that in Spring Boot plugin documentation.

Comment From: mhalbritter

It depends on the configuration of your Linux distribution. There's a unit named podman.socket, which should create that socket. If that's not enabled by default, the socket won't be there.

Maybe we need to update the documentation. What do you think, @scottfrederick ?

Comment From: ghilainm

Also @mhalbritter, that's another issue but after starting the socket as you suggested using systemctl --user start podman, when triggering the build of the image it freezes with no logs output.

Comment From: mhalbritter

the bootBuildImage is not outputting progress information when downloading the CNB images. Are you sure it's stuck or is it downloading in the background?

Comment From: ghilainm

It has been now working for more than 8 minutes. There is no sign of network activity (or at least intensive one), I can however see the podman process writing a lot, but to what I don't know.

SpringBoot bootBuildImage with Podman results in  socket connection error

Comment From: mhalbritter

Hm, to rule that out, you could run

podman pull docker.io/paketobuildpacks/builder-jammy-base:latest
podman pull docker.io/paketobuildpacks/run-jammy-base:latest

in a terminal, and then try bootBuildImage again.

Comment From: ghilainm

@mhalbritter Thx for the help. I can see from the console that it seems looping.

Trying to pull docker.io/paketobuildpacks/builder-jammy-base:latest...
Getting image source signatures
...
Copying blob c501d664298a skipped: already exists  
Copying blob 5cb34a5a7113 skipped: already exists  
Copying blob 3e02dcfe2fb6 skipped: already exists  
Copying blob 139eebe90b6d skipped: already exists  
Copying blob 35d7b7acab21 skipped: already exists  
Copying blob 193944e708e0 skipped: already exists  
...
Copying blob f78d0eb83193 skipped: already exists  
Copying blob f8ec9f186e6e skipped: already exists  
Copying blob 0e49f7c5ff21 skipped: already exists  
Copying blob db58f93730eb skipped: already exists  
Copying blob 5c5461e670ef skipped: already exists  
Copying blob 779573a7c701 skipped: already exists  
Copying blob 485e18b1f484 done  
Copying blob 25a278bb4d54 done  
Copying blob 367f9519e2c3 done  
Copying blob c98fa41a7189 done  
Copying blob e6c37a2281bd done  
Copying blob 3f85b0460b4d skipped: already exists  
Copying blob f0dc1033bfb0 done  
Copying blob 44de89a4970e done  

And the process never stops.

Comment From: mhalbritter

Then something is wrong with your installation. This is nothing we as the Spring Boot team could fix.

Comment From: ghilainm

@mhalbritter I agree with you :+1: .

Still the documentation update seems relevant to me :).

Comment From: scottfrederick

If this is a pre-requisite to start Podman service manually, it could be useful to document that in Spring Boot plugin documentation.

It depends on the configuration of your Linux distribution. There's a unit named podman.socket, which should create that socket. If that's not enabled by default, the socket won't be there.

We've decided to document this on a wiki page in the Spring Boot GitHub repository, instead of trying to maintain something like this in the documentation. See https://github.com/spring-projects/spring-boot/wiki/Building-OCI-Images-with-Spring-Boot#podman-socket-availability. Feel free to comment here with feedback on this documentation.