Not sure if this is a spring-boot or buildpacks error but I'm trying to use the task gradlew bootBuildImage to create a cloud native spring-boot 2.3.4 project.
It works fine locally but in bitbucket pipelines I get this error:
+ bash ./gradlew bootBuildImage
> Task :bootBuildImage
Building image 'docker.io/library/my-app:0.0.1-SNAPSHOT'
> Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' ..................................................
> Pulled builder image 'gcr.io/paketo-buildpacks/builder@sha256:bd63c901299d05e9766e54cf0b0926dcf9bd8e279b9ffeb5c75817f2a6264d61'
> Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' ..................................................
> Pulled run image 'paketobuildpacks/run@sha256:3694710d6b756c6583c51db41e1f1ba3f798bc64b3c437e3dd79d24e1ac28596'
> Executing lifecycle version v0.9.1
> Using build cache volume 'pack-cache-ff37938eddeb.build'
> Running creator
> Task :bootBuildImage FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootBuildImage'.
> Docker API call to 'localhost:2375/v1.24/containers/create' failed with status code 403 "Forbidden"
Anyone have any idea what this error means? It seems to fail on calling the creator task. I noticed Bitbucket is still running with Docker 18.09.9. Would that cause this issue?
Comment From: philwebb
This looks like a duplicate of #22840
Comment From: wilkinsona
I was typing this at the same time as Phil was commenting.
I agree that this appears to be a duplicate of https://github.com/spring-projects/spring-boot/issues/22840. However, looking at it led me to a Spotify Docker client pull request and a link from there to the Docker API where it states that "A Content-Length header should be present in POST requests to endpoints that expect a body".
It's not clear to me if this is an RFC-style should where it's something that's recommended but optional or if it's a requirement a must in RFC terms). It would appear that the local Docker daemon treats it as optional (but perhaps recommended) whereas BitBucket's pipelines treat it as a requirement. Either way, it's probably worth us complying with the API's recommendations if we can.
Comment From: Selikoff
First off, thanks for the quick reply. Is this at all related to the fact that Bitbucket is running Docker 18.09.9? In other words, could this be fixed when they finally update to Docker 19?
That said, is there any work around I could take? I understand there's the fully automated build option with bootBuildImage but could I get around this if I set up layering/Dockerfile manually?
Comment From: goatfryed
Hey hey, This is in fact a duplicate of #22840. I'm using gradle myself, so I'm familiar with both issues. ^^ I guess it's better to keep this one closed as duplicate and reopen the old one?
@Selikoff It seems like docker 19 won't fix this. Yes, it would work to set it all up manually or I've mentioned an alternative in the linked issue that I'm using until this gets resolved.
Comment From: wilkinsona
Good idea, @goatfryed. Particularly with your latest comment, there's more context in #22840 so let's use that one to track the problem.