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

bootBuildImage with Podman results in socket connection error #40127

Closed
ghilainm opened this issue Mar 28, 2024 · 11 comments
Closed

bootBuildImage with Podman results in socket connection error #40127

ghilainm opened this issue Mar 28, 2024 · 11 comments
Labels
type: wiki-documentation A documentation update required on the wiki

Comments

@ghilainm
Copy link

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 28, 2024
@mhalbritter
Copy link
Contributor

mhalbritter commented Mar 28, 2024

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?

@ghilainm
Copy link
Author

@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.

@mhalbritter
Copy link
Contributor

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 ?

@ghilainm
Copy link
Author

ghilainm commented Mar 28, 2024

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.

@mhalbritter
Copy link
Contributor

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?

@ghilainm
Copy link
Author

ghilainm commented Mar 28, 2024

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.

image

@mhalbritter
Copy link
Contributor

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.

@ghilainm
Copy link
Author

@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.

@mhalbritter
Copy link
Contributor

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

@ghilainm
Copy link
Author

@mhalbritter I agree with you 👍 .

Still the documentation update seems relevant to me :).

@scottfrederick scottfrederick changed the title bootBuildImage with Podman results in Connection to the Docker daemon at '/run/user/1001/podman/podman.sock' failed with error bootBuildImage with Podman results in socket connection error Mar 28, 2024
@scottfrederick
Copy link
Contributor

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.

@scottfrederick scottfrederick added type: wiki-documentation A documentation update required on the wiki and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: wiki-documentation A documentation update required on the wiki
Projects
None yet
Development

No branches or pull requests

4 participants