Skip to content

Spring Boot with native image container image build fails on podman due to directory permissions #45233

Closed
@dmikusa

Description

@dmikusa

Steps to Repro

  1. https://start.spring.io, Spring Boot 3.4.4, Java 21, Gradle. Add deps for native image + spring web. Download. Extract.
  2. Run ./gradlew bootBuildImage.

It will fail with the following error:

    [creator]     Finished generating 'com.example.demo.DemoApplication' in 1m 3s.
    [creator]       Removing bytecode
    [creator]     unable to invoke layer creator
    [creator]     unable to remove /workspace/BOOT-INF
    [creator]     unlinkat /workspace/BOOT-INF: permission denied
    [creator]     ERROR: failed to build: exit status 1

Normally, this is the point where the buildpack would clear out the Java class files and things you no longer need given this is a native image. It should be able to write to /workspace, but obviously cannot given this error.

Usually file permissions are inherited from the contents that are pushed into the build container, which I believe are the Boot JAR contents. I don't know the exact mechanics of how the Boot build tools plugin does this though.

Full build log -> build-log-gradle.txt

This was run on Mac OS Sequoia 15.4, Podman Desktop 1.17.2 (running Podman 5.4.1).

If I run the same build with the latest pack cli on the same system using the same JAR file, it does not have this issue. See build log from pack -> pack-log.txt

Paketo had a similar report where the user had this problem in conjunction with the <applicationDirectory>/myapp</applicationDirectory> option (--workspace with pack cli). I'm able to reproduce that as well, but that does not work with pack cli either. I'm mentioning this in case it does have the same underlying cause.

Thanks

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions