Add log message if Docker Compose services are already running

Closes gh-38398
This commit is contained in:
Moritz Halbritter
2023-12-05 14:02:16 +01:00
parent 24886eae64
commit 3f29c7f84f
2 changed files with 31 additions and 7 deletions

View File

@@ -118,14 +118,19 @@ class DockerComposeLifecycleManager {
Stop stop = this.properties.getStop();
Wait wait = this.properties.getReadiness().getWait();
List<RunningService> runningServices = dockerCompose.getRunningServices();
if (lifecycleManagement.shouldStart() && runningServices.isEmpty()) {
start.getCommand().applyTo(dockerCompose, start.getLogLevel());
runningServices = dockerCompose.getRunningServices();
if (wait == Wait.ONLY_IF_STARTED) {
wait = Wait.ALWAYS;
if (lifecycleManagement.shouldStart()) {
if (runningServices.isEmpty()) {
start.getCommand().applyTo(dockerCompose, start.getLogLevel());
runningServices = dockerCompose.getRunningServices();
if (wait == Wait.ONLY_IF_STARTED) {
wait = Wait.ALWAYS;
}
if (lifecycleManagement.shouldStop()) {
this.shutdownHandlers.add(() -> stop.getCommand().applyTo(dockerCompose, stop.getTimeout()));
}
}
if (lifecycleManagement.shouldStop()) {
this.shutdownHandlers.add(() -> stop.getCommand().applyTo(dockerCompose, stop.getTimeout()));
else {
logger.info("There are already Docker Compose services running, skipping startup");
}
}
List<RunningService> relevantServices = new ArrayList<>(runningServices);