Skip to content

Image builds with podman fail when image buildpacks are configured #34324

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

Closed
Janrupf opened this issue Feb 21, 2023 · 3 comments
Closed

Image builds with podman fail when image buildpacks are configured #34324

Janrupf opened this issue Feb 21, 2023 · 3 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@Janrupf
Copy link

Janrupf commented Feb 21, 2023

Following the documentation on how to configure podman for spring boot I ended up using the following configuration in gradle:

tasks.withType<org.springframework.boot.gradle.tasks.bundling.BootBuildImage> {
    environment.put("BP_NATIVE_IMAGE", "false")
    buildpacks.set(listOf(
        "gcr.io/paketo-buildpacks/ca-certificates:3.5.1",
        "gcr.io/paketo-buildpacks/bellsoft-liberica:9.10.0",
        "gcr.io/paketo-buildpacks/syft:1.23.0",
        "gcr.io/paketo-buildpacks/executable-jar:6.5.0",
        "gcr.io/paketo-buildpacks/spring-boot:5.20.0"
    ))
    val dockerHost = System.getenv("DOCKER_HOST")

    if (dockerHost != null) {
        docker {
            host.set(dockerHost)
            bindHostToBuilder.set(true)
        }
    }
}

This first appears to work, spring boot successfully communicates with the podman daemon and then pulls the buildpacks. However, when attempting to start the build the following error occurs:

> Task :bootBuildImage
Building image 'my.company/software:fdc1ac23'
 > Pulling builder image 'docker.io/paketobuildpacks/builder:base' ..................................................
 > Pulled builder image 'docker.io/paketobuildpacks/builder@sha256:11dcec699e2349838762e245c1c961d9e2c6e10d3e3617ec1e7bba19929caa11'
 > Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' ..................................................
 > Pulled run image 'docker.io/paketobuildpacks/run@sha256:b9cbbd4e962acac787cc2bdba8b9c97996675ef57155418c0c5c9cb088261434'
 > Pulling buildpack image 'gcr.io/paketo-buildpacks/ca-certificates:3.5.1' ..................................................
 > Pulled buildpack image 'gcr.io/paketo-buildpacks/ca-certificates@sha256:ad50eae8fa996f0bb7c85f48135e81121fb1a5f8c9e98cf57703a623e07bd479'
 > Pulling buildpack image 'gcr.io/paketo-buildpacks/bellsoft-liberica:9.10.0' ..................................................
 > Pulled buildpack image 'gcr.io/paketo-buildpacks/bellsoft-liberica@sha256:fef2cc126dfc0dd78398aa7131910d7c567e6bc799c74a2d93f577af85233cf4'
 > Pulling buildpack image 'gcr.io/paketo-buildpacks/syft:1.23.0' ..................................................
 > Pulled buildpack image 'gcr.io/paketo-buildpacks/syft@sha256:7c77ba8a7dbadc613fba70063ce43b3eeb1b7782424a01bdc60de634075f7d0a'
 > Pulling buildpack image 'gcr.io/paketo-buildpacks/executable-jar:6.5.0' ..................................................
 > Pulled buildpack image 'gcr.io/paketo-buildpacks/executable-jar@sha256:971568ae093406911d36fb07c35f589ee69b6c7a2d3f6b90e9e4e924f05baa13'
 > Pulling buildpack image 'gcr.io/paketo-buildpacks/spring-boot:5.20.0' ..................................................
 > Pulled buildpack image 'gcr.io/paketo-buildpacks/spring-boot@sha256:0b104efc035bb6f92b38721a237a0d29e9b38fa36a02c2ffd215b2f565654aa0'
 > Executing lifecycle version v0.16.0
 > Using build cache volume 'pack-cache-068ca50ea7f6.build'
 > Running creator
    [creator]     ===> ANALYZING
    [creator]     Previous image with name "my.company/software:fdc1ac23" not found
    [creator]     ===> DETECTING
    [creator]     ERROR: failed to initialize detector: open /cnb/buildpacks/paketo-buildpacks_bellsoft-liberica/9.10.0/buildpack.toml: no such file or directory
> Task :bootBuildImage FAILED
FAILURE: Build failed with an exception.

This appears to be related to using podman, which according to the documentation is supported. Switching back to the official docker daemon is sadly not an option.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 21, 2023
@scottfrederick
Copy link
Contributor

@Janrupf Thanks for the report. I can reproduce this error when using the configuration that you've shown above. If I remove the buildpacks.set(...) configuration from your sample, the image builds successfully for me. Would you mind trying to remove the custom buildpack config and see if you get the same results? That would help by confirming that we're looking at the right problem.

@scottfrederick scottfrederick added the status: waiting-for-feedback We need additional information before we can continue label Feb 21, 2023
@Janrupf
Copy link
Author

Janrupf commented Feb 21, 2023

Yes, removing the configuration works. Interestingly, the following configuration also works (I only changed the version numbers):

buildpacks.set(listOf(
    "gcr.io/paketo-buildpacks/ca-certificates:3.5.1",
    "gcr.io/paketo-buildpacks/bellsoft-liberica:9.10.3",
    "gcr.io/paketo-buildpacks/syft:1.24.2",
    "gcr.io/paketo-buildpacks/executable-jar:6.6.0",
    "gcr.io/paketo-buildpacks/spring-boot:5.22.1"
))

I additionally noticed that now my builds succeed, the image can apparently not be found whatsoever after building (the build succeeds, but the image does not exist). However, this probably is a separate issue (with podman?) or even some problem with my scripts.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Feb 21, 2023
@scottfrederick
Copy link
Contributor

Thanks for following up.

Interestingly, the following configuration also works (I only changed the version numbers)

If you use the pack CLI to inspect the builder image with pack inspect-builder paketobuildpacks/builder:base, you'll see the versions of all the buildpacks that are bundled in the builder. It appears that the buildpack versions you specified in your second configuration match the versions bundled in the most recent published builder.

When the Spring Boot plugin gets a list of buildpacks in its configuration, it will download each buildpack, compare it against buildpacks in the builder, and throw away any duplicate buildpack contents (see #31233 for the reason). So in your second example the buildpacks you specified are being used in the given order, but the buildpack contents are not being used.

I suspect something is going wrong when downloaded buildpack contents are added to the base builder contents. I'll dig deeper and see what I can find out.

@scottfrederick scottfrederick added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Feb 24, 2023
@scottfrederick scottfrederick added this to the 2.7.x milestone Feb 24, 2023
@scottfrederick scottfrederick self-assigned this Feb 24, 2023
@scottfrederick scottfrederick changed the title Image builds with podman fail Image builds with podman fails when image buildpacks are configured Mar 6, 2023
@scottfrederick scottfrederick changed the title Image builds with podman fails when image buildpacks are configured Image builds with podman fail when image buildpacks are configured Mar 6, 2023
@scottfrederick scottfrederick modified the milestones: 2.7.x, 2.7.10 Mar 6, 2023
izeye added a commit to izeye/spring-boot that referenced this issue Mar 12, 2023
wilkinsona pushed a commit that referenced this issue Mar 14, 2023
wilkinsona added a commit that referenced this issue Mar 14, 2023
* gh-34587:
  Polish Javadoc since tags for gh-34324

Closes gh-34587
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants