Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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' #37982

Closed
bossm0n5t3r opened this issue Oct 20, 2023 · 17 comments
Assignees
Labels
theme: containers Testcontainers, Docker Compose and Buildpack features type: bug A general bug
Milestone

Comments

@bossm0n5t3r
Copy link

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

Screenshot 2023-10-21 at 0 03 19
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: 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

Screenshot 2023-10-21 at 0 06 09 Screenshot 2023-10-21 at 0 07 00

docker compose version

Screenshot 2023-10-21 at 0 07 41

Without --no-trunc flag

Screenshot 2023-10-21 at 0 17 49
$ docker compose ps --format=json
{...,"ID":"4634e75ac669","Image":"postgres:latest",...}

With --no-trunc flag

Screenshot 2023-10-21 at 0 18 32
$ 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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 20, 2023
@wilkinsona wilkinsona changed the title Cannot invoke "org.springframework.boot.docker.compose.core.DockerCliInspectResponse.hostConfig()" because "inspectResponse" is null 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' Oct 20, 2023
@mhalbritter mhalbritter added type: bug A general bug theme: containers Testcontainers, Docker Compose and Buildpack features and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 23, 2023
@mhalbritter mhalbritter self-assigned this Oct 23, 2023
@mhalbritter mhalbritter added this to the 3.1.x milestone Oct 23, 2023
@mhalbritter mhalbritter modified the milestones: 3.1.x, 3.1.6 Oct 23, 2023
@osiegmar
Copy link

GitHub just updated their action runners by also updating to Docker Compose 2.23.0. See actions/runner-images@388d55d and actions/runner-images@ad34bed

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.

@michelbernardods
Copy link

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.

2023-11-06T23:11:43.342-03:00 ERROR 20165 --- [           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.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.docker.compose.core.DefaultConnectionPorts.<init>(DefaultConnectionPorts.java:47) ~[spring-boot-docker-compose-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.docker.compose.core.DefaultRunningService.<init>(DefaultRunningService.java:55) ~[spring-boot-docker-compose-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.docker.compose.core.DefaultDockerCompose.getRunningServices(DefaultDockerCompose.java:88) ~[spring-boot-docker-compose-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.startup(DockerComposeLifecycleManager.java:118) ~[spring-boot-docker-compose-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:53) ~[spring-boot-docker-compose-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:35) ~[spring-boot-docker-compose-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) ~[spring-context-6.0.8.jar:6.0.8]
	at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136) ~[spring-boot-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:98) ~[spring-boot-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.SpringApplicationRunListeners.lambda$contextLoaded$4(SpringApplicationRunListeners.java:72) ~[spring-boot-3.1.0-RC1.jar:3.1.0-RC1]
	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.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) ~[spring-boot-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:72) ~[spring-boot-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:415) ~[spring-boot-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[spring-boot-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1305) ~[spring-boot-3.1.0-RC1.jar:3.1.0-RC1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1294) ~[spring-boot-3.1.0-RC1.jar:3.1.0-RC1]

@michelbernardods
Copy link

I'm trying to downgrade docker compose to 2.20.3 on mac m1 but I can't, I've tried several ways like:

brew install [email protected]

reinstall docker, but it installs in the latest version which is 2.23.0

@wilkinsona
Copy link
Member

@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.

@LiveNathan

This comment was marked as resolved.

@wilkinsona

This comment was marked as resolved.

@LiveNathan

This comment was marked as off-topic.

@wilkinsona

This comment was marked as resolved.

@LiveNathan

This comment was marked as off-topic.

@SamBenningECG
Copy link

I just encountered this error after upgrading Docker Desktop on Windows to v4.25.1.

Reverted to v4.24.2 and its working.

@philwebb
Copy link
Member

@SamBenningECG Did you try the SNAPSHOT of Spring Boot 3.1.6?

@DaddyMoe

This comment was marked as off-topic.

@scottfrederick

This comment was marked as off-topic.

@harasees-singh
Copy link

I encountered this error after upgrading to a newer version of Docker Desktop on macos. An older version like v4.22.0 is working fine for me.

@scottfrederick
Copy link
Contributor

@harasees-singh What version of Spring Boot are you using? Can you try 3.1.6-SNAPSHOT and see if that works with the newer versions of Docker Desktop with Compose?

@harasees-singh
Copy link

@scottfrederick I am using Spring Boot version 3.1.0. I am unable to try 3.1.6-SNAPSHOT at the moment due to some complications.

baqterya added a commit to baqterya/muzukanji that referenced this issue Nov 23, 2023
kimyubi pushed a commit to kimyubi/OurHour that referenced this issue Dec 6, 2023
- Docker Desktop을 최신 버전으로 업데이트한 이후 다음과 같은 이슈가 발생하였고,
해당 이슈를 fixed한 버전으로 Spring Boot 버전 업그레이드함으로써 해결

- Issue : 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 nul

- Referece Link : spring-projects/spring-boot#37982
@atefbkl
Copy link

atefbkl commented Jan 13, 2024

I had the same problem but resolved with this config : spring-boot version 3.1.1 & docker-compose version 3.1.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: containers Testcontainers, Docker Compose and Buildpack features type: bug A general bug
Projects
None yet
Development

No branches or pull requests