Skip to content

Commit bdc5c05

Browse files
committed
Merge branch '3.1.x'
Closes gh-38145
2 parents 1ef66d2 + 87d6d51 commit bdc5c05

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/lifecycle/DockerComposeLifecycleManager.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ void start() {
121121
if (lifecycleManagement.shouldStart() && runningServices.isEmpty()) {
122122
start.getCommand().applyTo(dockerCompose, start.getLogLevel());
123123
runningServices = dockerCompose.getRunningServices();
124-
wait = (wait != Wait.ONLY_IF_STARTED) ? wait : Wait.ALWAYS;
124+
if (wait == Wait.ONLY_IF_STARTED) {
125+
wait = Wait.ALWAYS;
126+
}
125127
if (lifecycleManagement.shouldStop()) {
126128
this.shutdownHandlers.add(() -> stop.getCommand().applyTo(dockerCompose, stop.getTimeout()));
127129
}

spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/docker-compose.adoc

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@ Add the module dependency to your build, as shown in the following listings for
2828
}
2929
----
3030

31+
NOTE: The `docker compose` or `docker-compose` CLI application needs to be on your path in order for Spring Boot’s support to work correctly.
32+
3133
When this module is included as a dependency Spring Boot will do the following:
3234

3335
* Search for a `compose.yml` and other common compose filenames in your application directory
3436
* Call `docker compose up` with the discovered `compose.yml`
3537
* Create service connection beans for each supported container
3638
* Call `docker compose stop` when the application is shutdown
3739

38-
NOTE: The `docker compose` or `docker-compose` CLI application needs to be on your path in order for Spring Boot’s support to work correctly.
40+
If the Docker Compose services are already running when starting the application, Spring Boot will only create the service connection beans for each supported container.
41+
It will not call `docker compose up` again and it will not call `docker compose stop` when the application is shutdown.
3942

4043
NOTE: By default, Spring Boot's Docker Compose support is disabled when running tests.
4144
To enable it, set configprop:spring.docker.compose.skip.in-tests[] to `false`.

0 commit comments

Comments
 (0)