Hi,
I've recently started using Podman instead of Docker.
Since then, I have been unable to build Spring Boot Docker images using Paketo Buildpacks.
I've tried several solutions, but nothing has worked. That's why I am opening this issue for help.
Thanks!
Spring Boot and Java versions
I am using Spring Boot 3.4.0
and Java 21
.
Podman version
Here is the Podman version I am using
$ podman version
Client: Podman Engine
Version: 5.2.5
API Version: 5.2.5
Go Version: go1.23.2
Git Commit: 10c5aa720d59480bc7edad347c1f5d5b75d4424f
Built: Wed Oct 23 14:53:19 2024
OS/Arch: darwin/amd64
Server: Podman Engine
Version: 5.2.5
API Version: 5.2.5
Go Version: go1.22.7
Built: Thu Oct 17 21:00:00 2024
OS/Arch: linux/amd64
How to reproduce
It's very easy to reproduce:
- Generate the default demo project using Spring Initializr;
- Unzip the project;
- Inside the project folder, run
./mvnw clean -DskipTests spring-boot:build-image
.
Logs
$ ./mvnw clean -DskipTests spring-boot:build-image
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.4.0:clean (default-clean) @ demo ---
[INFO] Deleting /Downloads/demo/target
[INFO]
[INFO] >>> spring-boot:3.4.0:build-image (default-cli) > package @ demo >>>
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ demo ---
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO] Copying 0 resource from src/main/resources to target/classes
[INFO]
[INFO] --- compiler:3.13.0:compile (default-compile) @ demo ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 1 source file with javac [debug parameters release 21] to target/classes
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ demo ---
[INFO] skip non existing resourceDirectory /Downloads/demo/src/test/resources
[INFO]
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ demo ---
[INFO] Recompiling the module because of changed dependency.
[INFO] Compiling 1 source file with javac [debug parameters release 21] to target/test-classes
[INFO]
[INFO] --- surefire:3.5.2:test (default-test) @ demo ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- jar:3.4.2:jar (default-jar) @ demo ---
[INFO] Building jar: /Downloads/demo/target/demo-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot:3.4.0:repackage (repackage) @ demo ---
[INFO] Replacing main artifact /Downloads/demo/target/demo-0.0.1-SNAPSHOT.jar with repackaged archive, adding nested dependencies in BOOT-INF/.
[INFO] The original artifact has been renamed to /Downloads/demo/target/demo-0.0.1-SNAPSHOT.jar.original
[INFO]
[INFO] <<< spring-boot:3.4.0:build-image (default-cli) < package @ demo <<<
[INFO]
[INFO]
[INFO] --- spring-boot:3.4.0:build-image (default-cli) @ demo ---
[INFO] Building image 'docker.io/library/demo:0.0.1-SNAPSHOT'
[INFO]
[INFO] > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-java-tiny:latest' 100%
[INFO] > Pulled builder image 'docker.io/paketobuildpacks/builder-jammy-java-tiny@sha256:610f51689fdc104bc0636fbd4d5868afa54a769d1f8ac5b8c6be8f810c2a6dd1'
[INFO] > Pulling run image 'docker.io/paketobuildpacks/run-jammy-tiny:latest' for platform 'linux/amd64' 100%
[INFO] > Pulled run image 'docker.io/paketobuildpacks/run-jammy-tiny@sha256:2d87eb82a91fda704539eb12ffd9b178c44e05a937dad947faabb1341173602b'
[INFO] > Executing lifecycle version v0.20.4
[INFO] > Using build cache volume 'pack-cache-5cbe5692dbc4.build'
[INFO]
[INFO] > Running creator
[INFO] [creator] ===> ANALYZING
[INFO] [creator] Image with name "docker.io/library/demo:0.0.1-SNAPSHOT" not found
[INFO] [creator] Image with name "docker.io/paketobuildpacks/run-jammy-tiny:latest" not found
[INFO] [creator] ===> DETECTING
[INFO] [creator] target distro name/version labels not found, reading /etc/os-release file
[INFO] [creator] target distro name/version labels not found, reading /etc/os-release file
[INFO] [creator] 6 of 26 buildpacks participating
[INFO] [creator] paketo-buildpacks/ca-certificates 3.8.6
[INFO] [creator] paketo-buildpacks/bellsoft-liberica 11.0.0
[INFO] [creator] paketo-buildpacks/syft 2.4.0
[INFO] [creator] paketo-buildpacks/executable-jar 6.11.3
[INFO] [creator] paketo-buildpacks/dist-zip 5.8.5
[INFO] [creator] paketo-buildpacks/spring-boot 5.31.2
[INFO] [creator] ===> RESTORING
[INFO] [creator] ===> BUILDING
[INFO] [creator] target distro name/version labels not found, reading /etc/os-release file
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for CA Certificates 3.8.6
[INFO] [creator] https://github.com/paketo-buildpacks/ca-certificates
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_EMBED_CERTS false Embed certificates into the image
[INFO] [creator] $BP_ENABLE_RUNTIME_CERT_BINDING true Deprecated: Enable/disable certificate helper layer to add certs at runtime
[INFO] [creator] $BP_RUNTIME_CERT_BINDING_DISABLED false Disable certificate helper layer to add certs at runtime
[INFO] [creator] Launch Helper: Contributing to layer
[INFO] [creator] Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for BellSoft Liberica 11.0.0
[INFO] [creator] https://github.com/paketo-buildpacks/bellsoft-liberica
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_JVM_JLINK_ARGS --no-man-pages --no-header-files --strip-debug --compress=1 configure custom link arguments (--output must be omitted)
[INFO] [creator] $BP_JVM_JLINK_ENABLED false enables running jlink tool to generate custom JRE
[INFO] [creator] $BP_JVM_TYPE JRE the JVM type - JDK or JRE
[INFO] [creator] $BP_JVM_VERSION 21 the Java version
[INFO] [creator] Launch Configuration:
[INFO] [creator] $BPL_DEBUG_ENABLED false enables Java remote debugging support
[INFO] [creator] $BPL_DEBUG_PORT 8000 configure the remote debugging port
[INFO] [creator] $BPL_DEBUG_SUSPEND false configure whether to suspend execution until a debugger has attached
[INFO] [creator] $BPL_HEAP_DUMP_PATH write heap dumps on error to this path
[INFO] [creator] $BPL_JAVA_NMT_ENABLED true enables Java Native Memory Tracking (NMT)
[INFO] [creator] $BPL_JAVA_NMT_LEVEL summary configure level of NMT, summary or detail
[INFO] [creator] $BPL_JFR_ARGS configure custom Java Flight Recording (JFR) arguments
[INFO] [creator] $BPL_JFR_ENABLED false enables Java Flight Recording (JFR)
[INFO] [creator] $BPL_JMX_ENABLED false enables Java Management Extensions (JMX)
[INFO] [creator] $BPL_JMX_PORT 5000 configure the JMX port
[INFO] [creator] $BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation
[INFO] [creator] $BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation
[INFO] [creator] $BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
[INFO] [creator] $JAVA_TOOL_OPTIONS the JVM launch flags
[INFO] [creator] Using Java version 21 extracted from MANIFEST.MF
[INFO] [creator] BellSoft Liberica JRE 21.0.5: Contributing to layer
[INFO] [creator] Downloading from https://github.com/bell-sw/Liberica/releases/download/21.0.5+11/bellsoft-jre21.0.5+11-linux-amd64.tar.gz
[INFO] [creator] Verifying checksum
[INFO] [creator] Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jre
[INFO] [creator] Adding 146 container CA certificates to JVM truststore
[INFO] [creator] Writing env.launch/BPI_APPLICATION_PATH.default
[INFO] [creator] Writing env.launch/BPI_JVM_CACERTS.default
[INFO] [creator] Writing env.launch/BPI_JVM_CLASS_COUNT.default
[INFO] [creator] Writing env.launch/BPI_JVM_SECURITY_PROVIDERS.default
[INFO] [creator] Writing env.launch/JAVA_HOME.default
[INFO] [creator] Writing env.launch/JAVA_TOOL_OPTIONS.append
[INFO] [creator] Writing env.launch/JAVA_TOOL_OPTIONS.delim
[INFO] [creator] Writing env.launch/MALLOC_ARENA_MAX.default
[INFO] [creator] Launch Helper: Contributing to layer
[INFO] [creator] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/java-opts
[INFO] [creator] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jvm-heap
[INFO] [creator] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/link-local-dns
[INFO] [creator] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/memory-calculator
[INFO] [creator] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/security-providers-configurer
[INFO] [creator] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jmx
[INFO] [creator] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jfr
[INFO] [creator] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/openssl-certificate-loader
[INFO] [creator] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/security-providers-classpath-9
[INFO] [creator] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/debug-9
[INFO] [creator] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/nmt
[INFO] [creator] Java Security Properties: Contributing to layer
[INFO] [creator] Writing env.launch/JAVA_SECURITY_PROPERTIES.default
[INFO] [creator] Writing env.launch/JAVA_TOOL_OPTIONS.append
[INFO] [creator] Writing env.launch/JAVA_TOOL_OPTIONS.delim
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Syft 2.4.0
[INFO] [creator] https://github.com/paketo-buildpacks/syft
[INFO] [creator] Downloading from https://github.com/anchore/syft/releases/download/v1.15.0/syft_1.15.0_linux_amd64.tar.gz
[INFO] [creator] Verifying checksum
[INFO] [creator] Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Executable JAR 6.11.3
[INFO] [creator] https://github.com/paketo-buildpacks/executable-jar
[INFO] [creator] Class Path: Contributing to layer
[INFO] [creator] Writing env/CLASSPATH.delim
[INFO] [creator] Writing env/CLASSPATH.prepend
[INFO] [creator] Process types:
[INFO] [creator] executable-jar: java org.springframework.boot.loader.launch.JarLauncher (direct)
[INFO] [creator] task: java org.springframework.boot.loader.launch.JarLauncher (direct)
[INFO] [creator] web: java org.springframework.boot.loader.launch.JarLauncher (direct)
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Spring Boot 5.31.2
[INFO] [creator] https://github.com/paketo-buildpacks/spring-boot
[INFO] [creator] Build Configuration:
[INFO] [creator] $BPL_JVM_CDS_ENABLED false whether to enable CDS optimizations at runtime
[INFO] [creator] $BPL_SPRING_AOT_ENABLED false whether to enable Spring AOT at runtime
[INFO] [creator] $BP_JVM_CDS_ENABLED false whether to enable CDS & perform JVM training run
[INFO] [creator] $BP_SPRING_AOT_ENABLED false whether to enable Spring AOT
[INFO] [creator] $BP_SPRING_CLOUD_BINDINGS_DISABLED false whether to contribute Spring Boot cloud bindings support
[INFO] [creator] $BP_SPRING_CLOUD_BINDINGS_VERSION 1 default version of Spring Cloud Bindings library to contribute
[INFO] [creator] Launch Configuration:
[INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_DISABLED false whether to auto-configure Spring Boot environment properties from bindings
[INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_ENABLED true Deprecated - whether to auto-configure Spring Boot environment properties from bindings
[INFO] [creator] Creating slices from layers index
[INFO] [creator] dependencies (10.1 MB)
[INFO] [creator] spring-boot-loader (409.9 KB)
[INFO] [creator] snapshot-dependencies (0.0 B)
[INFO] [creator] application (4.4 KB)
[INFO] [creator] Spring Cloud Bindings 2.0.3: Contributing to layer
[INFO] [creator] Downloading from https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-bindings/2.0.3/spring-cloud-bindings-2.0.3.jar
[INFO] [creator] Verifying checksum
[INFO] [creator] Copying to /layers/paketo-buildpacks_spring-boot/spring-cloud-bindings
[INFO] [creator] Web Application Type: Contributing to layer
[INFO] [creator] Non-web application detected
[INFO] [creator] Writing env.launch/BPL_JVM_THREAD_COUNT.default
[INFO] [creator] Launch Helper: Contributing to layer
[INFO] [creator] Creating /layers/paketo-buildpacks_spring-boot/helper/exec.d/spring-cloud-bindings
[INFO] [creator] 4 application slices
[INFO] [creator] Image labels:
[INFO] [creator] org.opencontainers.image.title
[INFO] [creator] org.opencontainers.image.version
[INFO] [creator] org.springframework.boot.version
[INFO] [creator] ===> EXPORTING
[INFO] [creator] ERROR: failed to export: get run image top layer SHA: image has no layers
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.251 s
[INFO] Finished at: 2024-12-02T17:37:08-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.4.0:build-image (default-cli) on project demo: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.4.0:build-image failed: Builder lifecycle 'creator' failed with status code 62 -> [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/PluginExecutionException
Comment From: philwebb
I don't currently have easy access to an x86 Linux box, but can you double check if following this section of the docs solves things?
Comment From: scottfrederick
There are instructions in the Spring Boot documentation for configuring Spring Boot's image-building support for Podman. There are also some tips in the Spring Boot wiki that are more prescriptive (and subject to changes that are out of Spring Boot's control) as well as some troubleshooting tips for situations like this. Does any of this information help your situation?
Comment From: ivangfr
Thanks for your quick response.
Note: Using Podman, I am able to build Docker images using
Dockerfile
andpodman build
command and with Jib Maven Plugin.
Yes, I've tried before (and now again) the docs you shared.
The Packaging OCI Images wasn’t helpful. I tried adding the spring-boot-maven-plugin configuration
, but it didn’t solve the issue.
By the way, I created a symbolic link between Podman and Docker:
sudo ln -s $(which podman) /usr/local/bin/docker
This way, I don’t need to change the spring-boot-maven-plugin configuration
as suggested in the Packaging OCI Images guide.
As for the Building OCI Images with Spring Boot documentation, I’m using Podman Desktop.
Podman seems to be configured correctly, with Docker compatibility working as expected.
I also tried the "Testing with the pack CLI" approach. The command I used was:
pack build --builder paketobuildpacks/builder-jammy-java-tiny:latest --path target/demo-0.0.1-SNAPSHOT.jar demo
But I ran into a different error, again during the EXPORTING
phase. (logs below)
Thanks! I will keep trying. Worst case, I will move to Jib.
===> ANALYZING
[analyzer] Image with name "demo" not found
[analyzer] Image with name "index.docker.io/paketobuildpacks/run-jammy-tiny:latest" not found
===> DETECTING
[detector] target distro name/version labels not found, reading /etc/os-release file
[detector] target distro name/version labels not found, reading /etc/os-release file
[detector] 6 of 26 buildpacks participating
[detector] paketo-buildpacks/ca-certificates 3.8.6
[detector] paketo-buildpacks/bellsoft-liberica 11.0.0
[detector] paketo-buildpacks/syft 2.4.0
[detector] paketo-buildpacks/executable-jar 6.11.3
[detector] paketo-buildpacks/dist-zip 5.8.5
[detector] paketo-buildpacks/spring-boot 5.31.2
===> RESTORING
===> BUILDING
[builder] target distro name/version labels not found, reading /etc/os-release file
[builder]
[builder] Paketo Buildpack for CA Certificates 3.8.6
[builder] https://github.com/paketo-buildpacks/ca-certificates
[builder] Build Configuration:
[builder] $BP_EMBED_CERTS false Embed certificates into the image
[builder] $BP_ENABLE_RUNTIME_CERT_BINDING true Deprecated: Enable/disable certificate helper layer to add certs at runtime
[builder] $BP_RUNTIME_CERT_BINDING_DISABLED false Disable certificate helper layer to add certs at runtime
[builder] Launch Helper: Contributing to layer
[builder] Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[builder]
[builder] Paketo Buildpack for BellSoft Liberica 11.0.0
[builder] https://github.com/paketo-buildpacks/bellsoft-liberica
[builder] Build Configuration:
[builder] $BP_JVM_JLINK_ARGS --no-man-pages --no-header-files --strip-debug --compress=1 configure custom link arguments (--output must be omitted)
[builder] $BP_JVM_JLINK_ENABLED false enables running jlink tool to generate custom JRE
[builder] $BP_JVM_TYPE JRE the JVM type - JDK or JRE
[builder] $BP_JVM_VERSION 21 the Java version
[builder] Launch Configuration:
[builder] $BPL_DEBUG_ENABLED false enables Java remote debugging support
[builder] $BPL_DEBUG_PORT 8000 configure the remote debugging port
[builder] $BPL_DEBUG_SUSPEND false configure whether to suspend execution until a debugger has attached
[builder] $BPL_HEAP_DUMP_PATH write heap dumps on error to this path
[builder] $BPL_JAVA_NMT_ENABLED true enables Java Native Memory Tracking (NMT)
[builder] $BPL_JAVA_NMT_LEVEL summary configure level of NMT, summary or detail
[builder] $BPL_JFR_ARGS configure custom Java Flight Recording (JFR) arguments
[builder] $BPL_JFR_ENABLED false enables Java Flight Recording (JFR)
[builder] $BPL_JMX_ENABLED false enables Java Management Extensions (JMX)
[builder] $BPL_JMX_PORT 5000 configure the JMX port
[builder] $BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation
[builder] $BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation
[builder] $BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
[builder] $JAVA_TOOL_OPTIONS the JVM launch flags
[builder] Using Java version 21 extracted from MANIFEST.MF
[builder] BellSoft Liberica JRE 21.0.5: Contributing to layer
[builder] Downloading from https://github.com/bell-sw/Liberica/releases/download/21.0.5+11/bellsoft-jre21.0.5+11-linux-amd64.tar.gz
[builder] Verifying checksum
[builder] Expanding to /layers/paketo-buildpacks_bellsoft-liberica/jre
[builder] Adding 146 container CA certificates to JVM truststore
[builder] Writing env.launch/BPI_APPLICATION_PATH.default
[builder] Writing env.launch/BPI_JVM_CACERTS.default
[builder] Writing env.launch/BPI_JVM_CLASS_COUNT.default
[builder] Writing env.launch/BPI_JVM_SECURITY_PROVIDERS.default
[builder] Writing env.launch/JAVA_HOME.default
[builder] Writing env.launch/JAVA_TOOL_OPTIONS.append
[builder] Writing env.launch/JAVA_TOOL_OPTIONS.delim
[builder] Writing env.launch/MALLOC_ARENA_MAX.default
[builder] Launch Helper: Contributing to layer
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/java-opts
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jvm-heap
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/link-local-dns
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/memory-calculator
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/security-providers-configurer
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jmx
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/jfr
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/openssl-certificate-loader
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/security-providers-classpath-9
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/debug-9
[builder] Creating /layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/nmt
[builder] Java Security Properties: Contributing to layer
[builder] Writing env.launch/JAVA_SECURITY_PROPERTIES.default
[builder] Writing env.launch/JAVA_TOOL_OPTIONS.append
[builder] Writing env.launch/JAVA_TOOL_OPTIONS.delim
[builder]
[builder] Paketo Buildpack for Syft 2.4.0
[builder] https://github.com/paketo-buildpacks/syft
[builder] Downloading from https://github.com/anchore/syft/releases/download/v1.15.0/syft_1.15.0_linux_amd64.tar.gz
[builder] Verifying checksum
[builder] Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default
[builder]
[builder] Paketo Buildpack for Executable JAR 6.11.3
[builder] https://github.com/paketo-buildpacks/executable-jar
[builder] Class Path: Contributing to layer
[builder] Writing env/CLASSPATH.delim
[builder] Writing env/CLASSPATH.prepend
[builder] Process types:
[builder] executable-jar: java org.springframework.boot.loader.launch.JarLauncher (direct)
[builder] task: java org.springframework.boot.loader.launch.JarLauncher (direct)
[builder] web: java org.springframework.boot.loader.launch.JarLauncher (direct)
[builder]
[builder] Paketo Buildpack for Spring Boot 5.31.2
[builder] https://github.com/paketo-buildpacks/spring-boot
[builder] Build Configuration:
[builder] $BPL_JVM_CDS_ENABLED false whether to enable CDS optimizations at runtime
[builder] $BPL_SPRING_AOT_ENABLED false whether to enable Spring AOT at runtime
[builder] $BP_JVM_CDS_ENABLED false whether to enable CDS & perform JVM training run
[builder] $BP_SPRING_AOT_ENABLED false whether to enable Spring AOT
[builder] $BP_SPRING_CLOUD_BINDINGS_DISABLED false whether to contribute Spring Boot cloud bindings support
[builder] $BP_SPRING_CLOUD_BINDINGS_VERSION 1 default version of Spring Cloud Bindings library to contribute
[builder] Launch Configuration:
[builder] $BPL_SPRING_CLOUD_BINDINGS_DISABLED false whether to auto-configure Spring Boot environment properties from bindings
[builder] $BPL_SPRING_CLOUD_BINDINGS_ENABLED true Deprecated - whether to auto-configure Spring Boot environment properties from bindings
[builder] Creating slices from layers index
[builder] dependencies (10.1 MB)
[builder] spring-boot-loader (409.9 KB)
[builder] snapshot-dependencies (0.0 B)
[builder] application (4.4 KB)
[builder] Spring Cloud Bindings 2.0.3: Contributing to layer
[builder] Downloading from https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-bindings/2.0.3/spring-cloud-bindings-2.0.3.jar
[builder] Verifying checksum
[builder] Copying to /layers/paketo-buildpacks_spring-boot/spring-cloud-bindings
[builder] Web Application Type: Contributing to layer
[builder] Non-web application detected
[builder] Writing env.launch/BPL_JVM_THREAD_COUNT.default
[builder] Launch Helper: Contributing to layer
[builder] Creating /layers/paketo-buildpacks_spring-boot/helper/exec.d/spring-cloud-bindings
[builder] 4 application slices
[builder] Image labels:
[builder] org.opencontainers.image.title
[builder] org.opencontainers.image.version
[builder] org.springframework.boot.version
===> EXPORTING
[exporter] ERROR: failed to resolve inputs: run image not found in analyzed metadata
ERROR: failed to build: executing lifecycle: failed with status code: 3
Comment From: scottfrederick
By the way, I created a symbolic link between Podman and Docker: ... This way, I don’t need to change the spring-boot-maven-plugin configuration as suggested in the Packaging OCI Images guide.
This would only make a difference if the Spring Boot plugins were to shell out to a docker
executable to perform Docker operations, but the plugins don't work that way. They talk to the Docker daemon directly on a socket connection. This seems to be partially working since the plugin is successfully pulling the builder and run images, but the bindBuilderToHost
might still be required, depending on what the Podman Desktop's Docker Compatibility mode is doing.
Comment From: ivangfr
I've removed the symbolic link
$ sudo rm /usr/local/bin/docker
and added the spring
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<host>unix:///run/user/502/podman/podman.sock</host>
<bindHostToBuilder>true</bindHostToBuilder>
</docker>
</configuration>
</plugin>
The unix:///run/user/502/podman/podman.sock
, I've got running the command
$ podman system connection list
So, if the property bindHostToBuilder
set to true
, I get:
$ ./mvnw clean -DskipTests spring-boot:build-image
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.4.0:clean (default-clean) @ demo ---
[INFO] Deleting /Users/ivan.franchin/Downloads/demo/target
[INFO]
[INFO] >>> spring-boot:3.4.0:build-image (default-cli) > package @ demo >>>
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ demo ---
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO] Copying 0 resource from src/main/resources to target/classes
[INFO]
[INFO] --- compiler:3.13.0:compile (default-compile) @ demo ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 1 source file with javac [debug parameters release 21] to target/classes
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ demo ---
[INFO] skip non existing resourceDirectory /Users/ivan.franchin/Downloads/demo/src/test/resources
[INFO]
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ demo ---
[INFO] Recompiling the module because of changed dependency.
[INFO] Compiling 1 source file with javac [debug parameters release 21] to target/test-classes
[INFO]
[INFO] --- surefire:3.5.2:test (default-test) @ demo ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- jar:3.4.2:jar (default-jar) @ demo ---
[INFO] Building jar: /Users/ivan.franchin/Downloads/demo/target/demo-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot:3.4.0:repackage (repackage) @ demo ---
[INFO] Replacing main artifact /Users/ivan.franchin/Downloads/demo/target/demo-0.0.1-SNAPSHOT.jar with repackaged archive, adding nested dependencies in BOOT-INF/.
[INFO] The original artifact has been renamed to /Users/ivan.franchin/Downloads/demo/target/demo-0.0.1-SNAPSHOT.jar.original
[INFO]
[INFO] <<< spring-boot:3.4.0:build-image (default-cli) < package @ demo <<<
[INFO]
[INFO]
[INFO] --- spring-boot:3.4.0:build-image (default-cli) @ demo ---
[INFO] Building image 'docker.io/library/demo:0.0.1-SNAPSHOT'
[INFO]
[INFO] > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-java-tiny:latest' 100%
[INFO] > Pulled builder image 'docker.io/paketobuildpacks/builder-jammy-java-tiny@sha256:610f51689fdc104bc0636fbd4d5868afa54a769d1f8ac5b8c6be8f810c2a6dd1'
[INFO] > Pulling run image 'docker.io/paketobuildpacks/run-jammy-tiny:latest' for platform 'linux/amd64' 100%
[INFO] > Pulled run image 'docker.io/paketobuildpacks/run-jammy-tiny@sha256:2d87eb82a91fda704539eb12ffd9b178c44e05a937dad947faabb1341173602b'
[INFO] > Executing lifecycle version v0.20.4
[INFO] > Using build cache volume 'pack-cache-5cbe5692dbc4.build'
[INFO]
[INFO] > Running creator
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.119 s
[INFO] Finished at: 2024-12-02T22:23:14-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.4.0:build-image (default-cli) on project demo: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.4.0:build-image failed: Docker API call to '/var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock/v1.41/containers/create' failed with status code 500 "Internal Server Error" and message "make cli opts(): making volume mountpoint for volume /var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock: mkdir /var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock: operation not supported" -> [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/PluginExecutionException
By removing the bindHostToBuilder
property from the configuration
:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<host>unix:///run/user/502/podman/podman.sock</host>
</docker>
</configuration>
</plugin>
I get the same error as the ones in the description:
...
[INFO] [creator] Paketo Buildpack for Spring Boot 5.31.2
[INFO] [creator] https://github.com/paketo-buildpacks/spring-boot
[INFO] [creator] Build Configuration:
[INFO] [creator] $BPL_JVM_CDS_ENABLED false whether to enable CDS optimizations at runtime
[INFO] [creator] $BPL_SPRING_AOT_ENABLED false whether to enable Spring AOT at runtime
[INFO] [creator] $BP_JVM_CDS_ENABLED false whether to enable CDS & perform JVM training run
[INFO] [creator] $BP_SPRING_AOT_ENABLED false whether to enable Spring AOT
[INFO] [creator] $BP_SPRING_CLOUD_BINDINGS_DISABLED false whether to contribute Spring Boot cloud bindings support
[INFO] [creator] $BP_SPRING_CLOUD_BINDINGS_VERSION 1 default version of Spring Cloud Bindings library to contribute
[INFO] [creator] Launch Configuration:
[INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_DISABLED false whether to auto-configure Spring Boot environment properties from bindings
[INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_ENABLED true Deprecated - whether to auto-configure Spring Boot environment properties from bindings
[INFO] [creator] Creating slices from layers index
[INFO] [creator] dependencies (10.1 MB)
[INFO] [creator] spring-boot-loader (409.9 KB)
[INFO] [creator] snapshot-dependencies (0.0 B)
[INFO] [creator] application (4.6 KB)
[INFO] [creator] Spring Cloud Bindings 2.0.3: Contributing to layer
[INFO] [creator] Downloading from https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-bindings/2.0.3/spring-cloud-bindings-2.0.3.jar
[INFO] [creator] Verifying checksum
[INFO] [creator] Copying to /layers/paketo-buildpacks_spring-boot/spring-cloud-bindings
[INFO] [creator] Web Application Type: Contributing to layer
[INFO] [creator] Non-web application detected
[INFO] [creator] Writing env.launch/BPL_JVM_THREAD_COUNT.default
[INFO] [creator] Launch Helper: Contributing to layer
[INFO] [creator] Creating /layers/paketo-buildpacks_spring-boot/helper/exec.d/spring-cloud-bindings
[INFO] [creator] 4 application slices
[INFO] [creator] Image labels:
[INFO] [creator] org.opencontainers.image.title
[INFO] [creator] org.opencontainers.image.version
[INFO] [creator] org.springframework.boot.version
[INFO] [creator] ===> EXPORTING
[INFO] [creator] ERROR: failed to export: get run image top layer SHA: image has no layers
Comment From: mhalbritter
Does
podman system connection list
gives you the same as
podman info --format='{{.Host.RemoteSocket.Path}}'
?
And just to make sure I got all the information:
You're working on a MacOS x64, and using Podman Desktop (which creates a virtual machine running Linux x64). Correct?
Comment From: ivangfr
Hi,
Does
podman system connection list
return the same aspodman info --format='{{.Host.RemoteSocket.Path}}'
?
Kind of.
$ podman system connection list
Name URI Identity Default ReadWrite
podman-machine-default ssh://core@127.0.0.1:50242/run/user/502/podman/podman.sock /Users/my-user/.local/share/containers/podman/machine/machine false true
podman-machine-default-root ssh://root@127.0.0.1:50242/run/podman/podman.sock /Users/my-user/.local/share/containers/podman/machine/machine true true
$ podman info --format='{{.Host.RemoteSocket.Path}}'
/run/podman/podman.sock
I've used the /run/user/502/podman/podman.sock
as it was the one closed to the Spring Boot documentation.
However, even using the path outputed by podman info --format='{{.Host.RemoteSocket.Path}}'
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<host>unix:///run/podman/podman.sock</host>
</docker>
</configuration>
</plugin>
I have the same issue at EXPORTING phase:
...
[INFO] [creator] Image labels:
[INFO] [creator] org.opencontainers.image.title
[INFO] [creator] org.opencontainers.image.version
[INFO] [creator] org.springframework.boot.version
[INFO] [creator] ===> EXPORTING
[INFO] [creator] ERROR: failed to export: get run image top layer SHA: image has no layers
You're working on a MacOS x64, and using Podman Desktop (which creates a virtual machine running Linux x64)
Yes
Thanks!
Comment From: mhalbritter
Okay, I think I understand the problem.
podman machine list
should show 1 virtual VM running:
NAME VM TYPE CREATED LAST UP CPUS MEMORY DISK SIZE
podman-machine-default* qemu About an hour ago Currently running 1 2.147GB 107.4GB
With podman machine inspect
it shows under ConnectionInfo
/ PodmanSocket
/ Path
the socket which can be used to communicate with the machine:
"ConnectionInfo": {
"PodmanSocket": {
"Path": "/home/mhalbritter/.local/share/containers/podman/machine/podman-machine-default/podman.sock"
}
},
We now put that into our Spring Boot config:
<configuration>
<docker>
<host>/home/mhalbritter/.local/share/containers/podman/machine/podman-machine-default/podman.sock</host>
<bindHostToBuilder>true</bindHostToBuilder>
</docker>
</configuration>
Now this fails with:
Docker API call to '/home/mhalbritter/.local/share/containers/podman/machine/podman-machine-default/podman.sock/v1.41/containers/create' failed with status code 500 "Internal Server Error" and message "make cli opts(): making volume mountpoint for volume /home/mhalbritter/.local/share/containers/podman/machine/podman-machine-default/podman.sock: mkdir /home/mhalbritter/.local: permission denied"
That's because it now tries to mount /home/mhalbritter/.local/share/containers/podman/machine/podman-machine-default/podman.sock
on the podman virtual machine.
But this directory only exists on my local machine, not in the virtual machine. Let's find out what the podman socket inside the virtual machine is:
podman machine ssh
podman info --format='{{.Host.RemoteSocket.Path}}'
In my case, it's /run/user/1000/podman/podman.sock
.
Now we have a problem: outside the virtual machine the socket is /home/mhalbritter/.local/share/containers/podman/machine/podman-machine-default/podman.sock
, inside it's /run/user/1000/podman/podman.sock
.
To fix that, we can symlink the /run/user/1000/podman/podman.sock
on the local machine to /home/mhalbritter/.local/share/containers/podman/machine/podman-machine-default/podman.sock
, then the socket outside and inside of the virtual machine is the same:
ln -s /home/mhalbritter/.local/share/containers/podman/machine/podman-machine-default/podman.sock /run/user/1000/podman/podman.sock
And then fix the Spring Boot config:
<configuration>
<docker>
<host>/run/user/1000/podman/podman.sock</host>
<bindHostToBuilder>true</bindHostToBuilder>
</docker>
</configuration>
Now the build works. Caveat: I have no idea if that has any other consequences.
The same would work the other way around: create a symlink in the virtual machine from /home/mhalbritter/.local/share/containers/podman/machine/podman-machine-default/podman.sock
to /run/user/1000/podman/podman.sock
and it works.
The main problem here is that the paths outside of the virtual machine are different than inside.
Does that work for you, too?
Comment From: ivangfr
Hi @mhalbritter, thanks for the detailed explanation.
I've tried the steps. I am having problems to create the symlink.
$ podman machine list
NAME VM TYPE CREATED LAST UP CPUS MEMORY DISK SIZE
podman-machine-default applehv 19 hours ago Currently running 4 7.45GiB 100GiB
$ podman machine inspect
[{
...
"ConnectionInfo": {
"PodmanSocket": {
"Path": "/var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock"
},
"PodmanPipe": null
},
....
}]
$ podman machine ssh
...
root@localhost:~# podman info --format='{{.Host.RemoteSocket.Path}}'
/run/podman/podman.sock
root@localhost:~# exit
logout
$ ln -s /var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock /run/podman/podman.sock
ln: /run/podman/podman.sock: No such file or directory
I do not have the /run/podman/podman.sock
in my local.
Comment From: mhalbritter
My guess is that /run/podman
doesn't exist on your machine.
mkdir -p /run/podman
and then run
ln -s /var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock /run/podman/podman.sock
again.
Comment From: ivangfr
When I run
mkdir -p /run/podman
I get
mkdir: /run: Read-only file system
I've researched a bit and I got that "This is a common issue because macOS does not use the /run directory in the same way that some Linux distributions do"
In my Mac, I have the "run" folder inside "var", so "/var/run"
Running ls-la
in this folder, I have the symlink
$ ls -la /var/run
...
lrwxr-xr-x 1 root daemon 71 Dec 2 12:28 docker.sock -> /Users/my-user/.local/share/containers/podman/machine/podman.sock
...
Probably, this symlink was created by Podman Desktop.
Comment From: mhalbritter
Okay, then my workaround won't work.
You can do it the other way around:
SSH into the podman machine, then:
mkdir -p /var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/
ln -s /run/podman/podman.sock /var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock
and use this config:
<configuration>
<docker>
<host>/var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock</host>
<bindHostToBuilder>true</bindHostToBuilder>
</docker>
</configuration>
But those are just workarounds to hack around the fact that the paths inside the VM are different than on the host system. It seems that using podman machine (which Podman Desktop is using under the hood) just isn't supported. I don't know if we have workarounds for Docker Desktop in place or if they use a completely different approach.
Comment From: mhalbritter
Huh, interesting.
I just created a new podman machine from scratch:
podman machine rm
podman machine list <-- now empty
podman machine init --rootful
podman machine start
The --rootful
is important, otherwise /var/run/docker.sock
points to something unusable.
When doing podman machine ssh
then a ls -la /var/run/docker.sock
shows that there is a docker compatibility socket mapping back to /run/podman/podman.sock
. Exit the ssh now.
Then using podman machine inspect
I found the socket on my local machine (ConnectionInfo / PodmanSocket / Path) to talk to the podman machine, and then put this path in my Spring Boot config:
<configuration>
<docker>
<host>/path/to/machine.sock</host>
</docker>
</configuration>
without bindHostToBuilder
. Then a image build succeeded, because Spring Boot binds /var/run/docker.sock
from the podman machine into the image (under /var/run/docker.sock
, where CNB expects it), and /var/run/docker.sock
on the podman machine is really /run/podman/podman.sock
- in effect now the image running the build has access to podman.
Maybe that works for you?
Comment From: ivangfr
I've tried to create the symlink into the Podman machine (as you suggested before), but got "Operation not supported"
$ podman machine ssh
Connecting to vm podman-machine-default. To close connection, use `~.` or `exit`
...
root@localhost:~# ln -s /run/podman/podman.sock /var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock
ln: failed to create symbolic link '/var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock': Operation not supported
root@localhost:~#
Comment From: ivangfr
I've also tried this approach
Also, it didn't work. Same error at EXPORTING phase.
Here are the steps:
➜ demo podman machine stop
Machine "podman-machine-default" stopped successfully
➜ demo podman machine rm
The following files will be deleted:
/Users/ivan.franchin/.config/containers/podman/machine/applehv/podman-machine-default.json
/var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default.sock
/var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-gvproxy.sock
/var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock
/var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default.log
Are you sure you want to continue? [y/N] y
➜ demo podman machine list
NAME VM TYPE CREATED LAST UP CPUS MEMORY DISK SIZE
➜ demo podman machine init --rootful
Looking up Podman Machine image at quay.io/podman/machine-os:5.2 to create VM
Extracting compressed file: podman-machine-default-amd64.raw: done
Machine init complete
To start your machine run:
podman machine start
➜ demo podman machine start
Starting machine "podman-machine-default"
API forwarding listening on: /var/run/docker.sock
Docker API clients default to this address. You do not need to set DOCKER_HOST.
Machine "podman-machine-default" started successfully
➜ demo podman machine ssh
Connecting to vm podman-machine-default. To close connection, use `~.` or `exit`
Fedora CoreOS 40.20241019.2.0
Tracker: https://github.com/coreos/fedora-coreos-tracker
Discuss: https://discussion.fedoraproject.org/tag/coreos
Last login: Tue Dec 3 16:14:24 2024
root@localhost:~# ls -la /var/run/docker.sock
srw-rw----. 1 root docker 0 Dec 3 13:14 /var/run/docker.sock
root@localhost:~# exit
logout
➜ demo podman machine inspect
[
{
...
"ConnectionInfo": {
"PodmanSocket": {
"Path": "/var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock"
},
"PodmanPipe": null
},
...
}
]
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<host>/var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock</host>
</docker>
</configuration>
</plugin>
➜ demo ./mvnw clean spring-boot:build-image
...
[INFO] [creator] Image labels:
[INFO] [creator] org.opencontainers.image.title
[INFO] [creator] org.opencontainers.image.version
[INFO] [creator] org.springframework.boot.version
[INFO] [creator] ===> EXPORTING
[INFO] [creator] ERROR: failed to export: get run image top layer SHA: image has no layers
...
**Comment From: mhalbritter**
Okay, back to square one. Hm. Thanks for giving it a try.
**Comment From: ivangfr**
Thank you, @mhalbritter, for the help so far.
**Comment From: mhalbritter**
I can at least reproduce the error on my Mac M1 machine, so it's not something x64 specific.
**Comment From: aaron-armada**
More discussion here: https://cloud-native.slack.com/archives/C033DV8D9FB/p1733249093064199
Still no resolution.
**Comment From: aaron-armada**
> I've tried to create the symlink into the **Podman** machine (as you [suggested](https://github.com/spring-projects/spring-boot/issues/43354#issuecomment-2514570857) before), but got **"Operation not supported"**
>
> ```
> $ podman machine ssh
> Connecting to vm podman-machine-default. To close connection, use `~.` or `exit`
> ...
> root@localhost:~# ln -s /run/podman/podman.sock /var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock
> ln: failed to create symbolic link '/var/folders/vg/m6b9wfbn0xg5zh976dw1ck5m0000gp/T/podman/podman-machine-default-api.sock': Operation not supported
> root@localhost:~#
> ```
This may be due to the `podman-machine-default-api.sock` already existing. You can delete that file and then try the `ln` command again.
**Comment From: ivangfr**
Hi, here's an update from my side regarding this issue.
When I replaced **Docker** with **Podman**, I initially installed Podman using the **installer** recommended on the Podman website.
However, yesterday I removed the Podman installation and installed it this time using **Homebrew**. Surprisingly, it now works.
The Podman version I am currently using is `5.4.1`:
$ podman --version podman version 5.4.1 ```