Open
Description
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
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
philwebb commentedon Dec 2, 2024
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?
scottfrederick commentedon Dec 2, 2024
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?
ivangfr commentedon Dec 3, 2024
Thanks for your quick response.
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:
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:
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.
scottfrederick commentedon Dec 3, 2024
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 thebindBuilderToHost
might still be required, depending on what the Podman Desktop's Docker Compatibility mode is doing.ivangfr commentedon Dec 3, 2024
I've removed the symbolic link
and added the spring
The
unix:///run/user/502/podman/podman.sock
, I've got running the commandSo, if the property
bindHostToBuilder
set totrue
, I get:By removing the
bindHostToBuilder
property from theconfiguration
:I get the same error as the ones in the description:
mhalbritter commentedon Dec 3, 2024
Does
gives you the same as
?
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?
ivangfr commentedon Dec 3, 2024
Hi,
Kind of.
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}}'
I have the same issue at EXPORTING phase:
Yes
Thanks!
mhalbritter commentedon Dec 3, 2024
Okay, I think I understand the problem.
podman machine list
should show 1 virtual VM running:With
podman machine inspect
it shows underConnectionInfo
/PodmanSocket
/Path
the socket which can be used to communicate with the machine:We now put that into our Spring Boot config:
Now this fails with:
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:
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:And then fix the Spring Boot config:
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?
ivangfr commentedon Dec 3, 2024
Hi @mhalbritter, thanks for the detailed explanation.
I've tried the steps. I am having problems to create the symlink.
I do not have the
/run/podman/podman.sock
in my local.mhalbritter commentedon Dec 3, 2024
My guess is that
/run/podman
doesn't exist on your machine.and then run
again.
ivangfr commentedon Dec 3, 2024
When I run
I get
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 symlinkProbably, this symlink was created by Podman Desktop.
15 remaining items