spring-boot: Docker Compose integration does not work with 2.23.0 due to 'Cannot invoke "org.springframework.boot.docker.compose.core.DockerCliInspectResponse.hostConfig()" because "inspectResponse" is null'
I’m getting a NPE because the key in inspected
map and the ID of DockerCliComposePsResponse
are different, so the value of that Map could not be found.
Screenshots
console when run spring boot
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.1.5)
2023-10-21T00:05:19.654+09:00 INFO 4906 --- [ main] m.z.ServerApplicationKt : Starting ServerApplicationKt using Java 17.0.9 with PID 4906
2023-10-21T00:05:19.656+09:00 INFO 4906 --- [ main] m.z.ServerApplicationKt : The following 1 profile is active: "local"
2023-10-21T00:05:19.694+09:00 INFO 4906 --- [ main] .s.b.d.c.l.DockerComposeLifecycleManager : Using Docker Compose file 'some/path/compose.yaml'
2023-10-21T00:11:45.208+09:00 ERROR 4906 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.NullPointerException: Cannot invoke "org.springframework.boot.docker.compose.core.DockerCliInspectResponse.hostConfig()" because "inspectResponse" is null
at org.springframework.boot.docker.compose.core.DefaultConnectionPorts.isHostNetworkMode(DefaultConnectionPorts.java:56) ~[spring-boot-docker-compose-3.1.5.jar:3.1.5]
at org.springframework.boot.docker.compose.core.DefaultConnectionPorts.<init>(DefaultConnectionPorts.java:47) ~[spring-boot-docker-compose-3.1.5.jar:3.1.5]
at org.springframework.boot.docker.compose.core.DefaultRunningService.<init>(DefaultRunningService.java:55) ~[spring-boot-docker-compose-3.1.5.jar:3.1.5]
at org.springframework.boot.docker.compose.core.DefaultDockerCompose.getRunningServices(DefaultDockerCompose.java:83) ~[spring-boot-docker-compose-3.1.5.jar:3.1.5]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.start(DockerComposeLifecycleManager.java:120) ~[spring-boot-docker-compose-3.1.5.jar:3.1.5]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:53) ~[spring-boot-docker-compose-3.1.5.jar:3.1.5]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:35) ~[spring-boot-docker-compose-3.1.5.jar:3.1.5]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:174) ~[spring-context-6.0.13.jar:6.0.13]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) ~[spring-context-6.0.13.jar:6.0.13]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:145) ~[spring-context-6.0.13.jar:6.0.13]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:133) ~[spring-context-6.0.13.jar:6.0.13]
at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:98) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextLoaded$4(SpringApplicationRunListeners.java:72) ~[spring-boot-3.1.5.jar:3.1.5]
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:72) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:420) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-3.1.5.jar:3.1.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-3.1.5.jar:3.1.5]
Break point
docker compose version
Without --no-trunc
flag
$ docker compose ps --format=json
{...,"ID":"4634e75ac669","Image":"postgres:latest",...}
With --no-trunc
flag
$ docker compose ps --format=json --no-trunc
{...,"ID":"4634e75ac66930fbce37ec146669182dabfa2f7b254a5f6afaa34d1cf15dbb65","Image":"postgres:latest",...}
The current docker compose cli version has been updated, and it is expected to be solved by attaching --no-trunc
flag.
- updated version: https://github.com/docker/compose/releases/tag/v2.23.0
- related pr: https://github.com/docker/compose/pull/11038
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Reactions: 6
- Comments: 16 (6 by maintainers)
Commits related to this issue
- Downgrade docker compose to support spring https://github.com/spring-projects/spring-boot/issues/37982 https://github.com/spring-projects/spring-boot/commit/09821feb7559ab15433bf01f6eda86db208dc198 — committed to land-of-apps/rails-7-app by petecheslock 8 months ago
- Downgrade Docker Compose to support spring boot https://github.com/spring-projects/spring-boot/commit/09821feb7559ab15433bf01f6eda86db208dc198 https://github.com/spring-projects/spring-boot/issues/37... — committed to land-of-apps/sample_spring_app by petecheslock 8 months ago
- Upgrade spring boot, dependencies to resolve startup issue 'https://github.com/spring-projects/spring-boot/issues/37982' — committed to rahulva/open-hands-api by deleted user 7 months ago
- updated from spring boot 3.1.5 to 3.1.6 as 3.1.5 has problems with docker integration (see github.com/spring-projects/spring-boot/issues/37982) — committed to baqterya/muzukanji by baqterya 7 months ago
- Chore : Spring Boot Version Up (3.1.6 -> 3.2.0) - Docker Desktop을 최신 버전으로 업데이트한 이후 다음과 같은 이슈가 발생하였고, 해당 이슈를 fixed한 버전으로 Spring Boot 버전 업그레이드함으로써 해결 - Issue : Docker Compose integration does not work... — committed to kimyubi/OurHour by deleted user 7 months ago
@michelbernardods this issue should be fixed in 3.1.6 that will be released later this month. Please try 3.1.6-SNAPSHOT, available from https://repo.spring.io/snapshot.
@DaddyMoe You need to configure
pluginRepositories
to find snapshot versions of the Spring Boot Maven plugin. Snapshots frequently depend on milestone releases of other Spring dependencies, so the full configuration should look like this:My operating system is MacOS m1 and I also have the same problem.
Docker compose up is working and when I start the java application with spring boot it breaks.
GitHub just updated their action runners by also updating to Docker Compose 2.23.0. See https://github.com/actions/runner-images/commit/388d55d0d741619a8718061d401166ebdc1f01f5 and https://github.com/actions/runner-images/commit/ad34bed33ee26de0337eb082dbda0680026d7ac6
All docker compose related spring-boot tasks are currently broken – at least with Ubuntu 20.04 and 22.04.
Unsure who needs to fix that.