After start the project, I can't connect to the container using docker exec -it sb-repro [bash | sh]
. The error:
OCI runtime exec failed: exec failed: unable to start container process: exec: "bash": executable file not found in $PATH: unknown
Is any shell available? Or is it needed to explicitly add some buildpack here?
To build your container image, you used this specific buildpack:
buildpacks.set(listOf("gcr.io/paketo-buildpacks/java-native-image"))
and you also used the GraalVM Native build tool:
id("org.graalvm.buildtools.native")
If you look at the Gradle Spring Boot plugin documentation, you'll notice that using the build tool makes the plugin use paketobuildpacks/builder-jammy-tiny:latest
instead of paketobuildpacks/builder-jammy-base:latest
:
paketobuildpacks/builder-jammy-base:latest or paketobuildpacks/builder-jammy-tiny:latest when GraalVM Native Image plugin is applied.
And to make the image size smaller, the tiny
variant does not embed common Unix tools such as bash
nor sh
- which makes the built images even more secure (smaller attack surface) - but less debugable too...
I suggest you debug using the paketobuildpacks/builder-jammy-base:latest
base image, run your build with
./gradlew --builder paketobuildpacks/builder-jammy-base:latest bootBuildImage
or updating your build.gradle.kts
with:
tasks.withType<BootBuildImage> {
builder.set("paketobuildpacks/builder-jammy-base:latest")
...
}