Closed
Description
Problem
gradlew buildBootImage
fails with permission denied when used on macOS Sonoma (14) with podman as a container engine.
Steps to reproduce
- Create a simple project on start.spring.io with the following characteristics:
- Project: Gradle-kotlin
- Language: Java
- Spring Boot: 3.2.3
- Packaging: Jar
- Java: 21
- Dependencies: Spring Web
- Unzip the project somewhere and
cd
into it - Upgrade the Gradle Wrapper to v8.6
- Run the
./gradlew bootBuildImage
command
Error
$ cd spring-podman
Using java version 21.0.2-librca in this shell.
$ ./gradlew bootBuildImage
> Task :bootBuildImage
Building image 'docker.io/library/spring-podman:0.0.1-SNAPSHOT'
> Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' ..................................................
> Pulled builder image 'docker.io/paketobuildpacks/builder-jammy-base@sha256:94593b2ad54362e1256da43631661d3dad936a177609a3d297fc638e87c6ee91'
> Pulling run image 'docker.io/paketobuildpacks/run-jammy-base:latest' ..................................................
> Pulled run image 'docker.io/paketobuildpacks/run-jammy-base@sha256:c2bc9ac828642aee2376a649ef5affd6912507c739247a40086bcae6d62a8b41'
> Executing lifecycle version v0.18.5
> Using build cache volume 'pack-cache-f19174dfe539.build'
> Running creator
[creator] ===> ANALYZING
[creator] ERROR: failed to initialize analyzer: getting previous image: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/info": dial unix /var/run/docker.sock: connect: permission denied
> Task :bootBuildImage FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootBuildImage'.
> Builder lifecycle 'creator' failed with status code 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 5s
5 actionable tasks: 5 executed
More info
Podman is configured to have docker compatibility activated. This is visible in Podman Desktop's dashboard.
These are the sockets and their properties:
$ ls -l /var/run/docker.sock
lrwxr-xr-x 1 root daemon 75 Mar 4 09:05 /var/run/docker.sock@ -> /Users/andrea.cisternino/.local/share/containers/podman/machine/podman.sock
$ ls -l /Users/andrea.cisternino/.local/share/containers/podman/machine/podman.sock
lrwxr-xr-x@ 1 andrea.cisternino staff 80 Feb 2 09:23 /Users/andrea.cisternino/.local/share/containers/podman/machine/podman.sock -> /Users/andrea.cisternino/.local/share/containers/podman/machine/qemu/podman.sock
$ ls -l /Users/andrea.cisternino/.local/share/containers/podman/machine/qemu/podman.sock
srw------- 1 andrea.cisternino staff 0 Mar 4 09:05 /Users/andrea.cisternino/.local/share/containers/podman/machine/qemu/podman.sock
Versions:
- Spring 3.2.3
- macOS: Sonoma 14.3.1
- Java 21.0.2 (BellSoft 21.0.2+14-LTS)
- Gradle 8.6
- Podman Desktop 1.7.1
$ podman version
Client: Podman Engine
Version: 4.9.2
API Version: 4.9.2
Go Version: go1.21.6
Git Commit: f9a48ebcfa9a39144be0f86f4ba842752835f945
Built: Sat Feb 3 00:31:39 2024
OS/Arch: darwin/arm64
Server: Podman Engine
Version: 4.8.3
API Version: 4.8.3
Go Version: go1.21.5
Built: Wed Jan 3 15:10:40 2024
OS/Arch: linux/arm64