Using the new Spring Boot maven plugin goal spring-boot:build-image I faced the following build failure:

Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.3.0.M1:build-image failed: Docker API call to 'docker://localhost/v1.40/images/create?fromImage=docker.io%2Fcloudfoundry%2Fcnb%3A0.0.43-bionic' failed with status code 400 "Bad Request"

According to the Docker API version matrix it seems at least Docker v19.03 is needed (implementing API version 1.40) while I currently am on Docker v18.09 which implements API version 1.39.

Is the very latest version of Docker really needed to build OCI images?

Please consider supporting a wider range of Docker versions or otherwise explicitly document the minimum Docker version needed.

Comment From: AlexFalappa

Had a look at the commits history and noticed the API version was hardcoded in spring-boot-project/spring-boot-tools/spring-boot-cloudnativebuildpack/src/main/java/org/springframework/boot/cloudnativebuildpack/docker/DockerApi.java.

According to Docker API documentation version less API URLs are deprecated but should anyway be possible to use a lower version since newer daemons will be retro compatible.

Comment From: wilkinsona

We don't use much of the Docker API at all so our required version could certainly be lower. The question is how much lower should it be. At the time of writing, the documentation says the following:

Docker does not recommend running versions prior to 1.12, which means you are encouraged to use an API version of 1.24 or higher.

I believe that 1.24 meets our requirements so it's tempting to go with that.

Comment From: hantsy

I got a 500 error when using 2.3.0.RELEASE with the latest Docker Desktop, check here.

Comment From: scottfrederick

@hantsy Please don't comment on close issues to bring attention to a Stack Overflow question. You are getting support on SO, let's keep the discussion there.

Comment From: lixinchuang

this issue is really not fixed! i encountered the same problem when using springboot 2.3.0 GA I checked the docker API version Api-Version: 1.39

Comment From: lixinchuang

so you could not hard code the API_VERSION = 1.24 , it doesn't work

Comment From: wilkinsona

you could not hard code the API_VERSION

We believe that this is what we should do. Docker's documentation on versioning says the following:

If you omit the version-prefix, the current version of the API (v1.40) is used. For example, calling /info is the same as calling /v1.40/info. Using the API without a version-prefix is deprecated and will be removed in a future release.

So, to avoid using deprecated functionality, we are using a versioned URI. An API version of 1.39 suggests you are running Docker 18.09. It supports API version 1.12 and newer so using 1.24 should not be a problem.

It's unclear from what you've provided thus far what is causing your problem, but I do not believe it is our usage of the 1.24 API. If you would like us to spend some more time investigating please open a new issue and take the time to describe your problem in detail and the steps that we can follow to reproduce it.