From 4625534e838a5c09eb58be0c48173efe9c418f42 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 19 Nov 2025 10:33:34 -0800 Subject: [PATCH] Force Testcontainers Docker API version for Docker 29.0.0+ compatibility Add `docker-java.properties` to spring-boot-testcontainers and `spring-boot-test` to force an API version upgrade. Fixes gh-48104 --- .../src/docs/antora/modules/how-to/pages/testing.adoc | 10 ++++++++++ .../src/main/resources/docker-java.properties | 1 + .../src/main/resources/docker-java.properties | 1 + 3 files changed, 12 insertions(+) create mode 100644 spring-boot-project/spring-boot-test/src/main/resources/docker-java.properties create mode 100644 spring-boot-project/spring-boot-testcontainers/src/main/resources/docker-java.properties diff --git a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/how-to/pages/testing.adoc b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/how-to/pages/testing.adoc index 1223b882621..00a8cfd1d63 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/antora/modules/how-to/pages/testing.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/antora/modules/how-to/pages/testing.adoc @@ -43,3 +43,13 @@ include-code::MyDatasourceConfiguration[] Having a single configuration class can be inefficient when beans from a certain domain need to be included in slice tests. Instead, structuring the application's configuration as multiple granular classes with beans for a specific domain can enable importing them only for specific slice tests. + + +[[howto.testing.testcontainers-api-downgrade]] +== Downgrading Testcontainers Docker API Version + +Recent versions of Docker Desktop do not support the default API version used by the Testcontainers dependency managed by Spring Boot. +To help prevent issues, Spring Boot ships with `docker-java.properties` files in the `spring-boot-testcontainers` and `spring-boot-test` jars that upgrade the API version that Testcontainers uses. + +If you don't want the API version to be changed, you should add a `docker-java.properties` file in your own projects classpath. +An empty file will restore default behavior, or you can set a `api.version` property to whatever value you prefer. diff --git a/spring-boot-project/spring-boot-test/src/main/resources/docker-java.properties b/spring-boot-project/spring-boot-test/src/main/resources/docker-java.properties new file mode 100644 index 00000000000..d06ebb9264e --- /dev/null +++ b/spring-boot-project/spring-boot-test/src/main/resources/docker-java.properties @@ -0,0 +1 @@ +api.version=1.44 diff --git a/spring-boot-project/spring-boot-testcontainers/src/main/resources/docker-java.properties b/spring-boot-project/spring-boot-testcontainers/src/main/resources/docker-java.properties new file mode 100644 index 00000000000..d06ebb9264e --- /dev/null +++ b/spring-boot-project/spring-boot-testcontainers/src/main/resources/docker-java.properties @@ -0,0 +1 @@ +api.version=1.44