After upgrading to spring boot 3.4.1 my application isn't working anymore on Windows because of an unknown --orphans flag.
I'm using the Docker Desktop version 4.37.1 (178610), which is the latest.
2025-01-14 08:01:24.055 ERROR [traceId=,spanId=] --- [ main] o.s.boot.SpringApplication :
Application run failed
org.springframework.boot.docker.compose.core.ProcessExitException: 'docker compose --file C:\Users\<snip>\app\docker-compose.yml --ansi never --profile local ps --orphans=false --format=json' failed with exit code 16.
Stdout:
Stderr:
unknown flag: --orphans
at org.springframework.boot.docker.compose.core.ProcessRunner.run(ProcessRunner.java:97)
at org.springframework.boot.docker.compose.core.DockerCli.run(DockerCli.java:77)
at org.springframework.boot.docker.compose.core.DefaultDockerCompose.runComposePs(DefaultDockerCompose.java:132)
at org.springframework.boot.docker.compose.core.DefaultDockerCompose.getRunningServices(DefaultDockerCompose.java:96)
at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.start(DockerComposeLifecycleManager.java:124)
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:53)
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:35)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136)
at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:98)
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextLoaded$4(SpringApplicationRunListeners.java:72)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112)
at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:72)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:416)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:317)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350)
at nl.<snip>.main(<snip>.java:24)
I think the --orphans flag does not exist on docker-compose for Windows.
The version of docker-compose included in the latest Docker Desktop for Windows is v2.29.7-desktop.1.
Switching back to 4.3.0 fixes the issue. Colleagues on Windows using Rancher Desktop, or colleagues using MacOS do not have this issue.
I saw some recent (fixed) issues related to the use of --orphans that might have introduced this issue:
https://github.com/spring-projects/spring-boot/issues/43710
https://github.com/spring-projects/spring-boot/issues/40139
Comment From: bclozel
Hello @boyvanduuren Can you replicate the same behavior on the CLI directly with docker desktop? Can you share the output of:
$ docker compose ps --orphans
$ docker compose version
The minimum requirement should be docker compose 2.24 as this feature was introduced in https://github.com/docker/compose/commit/caa0cbbc4b174d92a061c6ac4b591dc704988647. I don't see any sign pointing to this feature not being available on windows.
Comment From: quaff
@boyvanduuren Please try 3.4.2-SNAPSHOT, it's fixed by https://github.com/spring-projects/spring-boot/issues/43717.
Comment From: bclozel
@quaff Please refrain from commenting without reading prior discussions.
The reporter already shared that they're using docker compose v2.29.7-desktop.1, so #43717 is not likely to help as it's parsing the version.
Comment From: boyvanduuren
Hi @bclozel, I mentioned the docker-compose version in the bug report. It is v2.29.7-desktop.1.
It seems the version returned by docker compose is different than is being returned from docker-compose though:
❯ docker compose version
Docker Compose version v2.11.1
❯ docker-compose --version
Docker Compose version v2.29.7-desktop.1
Both are provided by the Docker Desktop installation though:
❯ Get-Command docker
CommandType Name Version Source
----------- ---- ------- ------
Application docker.exe 0.0.0.0 C:\Program Files\Docker\Docker\resources\bin\docker.exe
❯ Get-Command docker-compose
CommandType Name Version Source
----------- ---- ------- ------
Application docker-compose.exe 0.0.0.0 C:\Program Files\Docker\Docker\resources\bin\docker-compose.exe
I can confirm that --orphans works when passing it to docker-compose, but not to docker compose:
❯ docker compose ps --orphans
unknown flag: --orphans
❯ docker-compose ps --orphans
no configuration file provided: not found
There's a chance that this is now broken for people using Docker Desktop for Windows. I checked with one other colleague that uses it and has the same issue.
Comment From: wilkinsona
Thanks, @boyvanduuren. Spring Boot calls docker compose so it's that version that matters. As you're running 2.11.1, #43717 should help here. Please try 3.4.2-SNAPSHOT that's available from https://repo.spring.io/snapshot.
Comment From: boyvanduuren
I can confirm 3.4.2-SNAPSHOT is working!
Comment From: wilkinsona
Thanks for letting us know, @boyvanduuren.