To reduce startup/shutdown time for local development I'm currently using the start-only option for Docker Compose:

spring.docker.compose.lifecycle-management: start-only

However, I noticed that if I change the existing services in the associated Docker Compose file (change port, volume, env vars, etc.), then these changes are not picked up automatically on the next Spring Boot application startup and I need to manually stop/restart the Compose services to take effect. Of course this is not a very common scenario but I think it's something which could be supported.

I see two possible options to handle this: 1. In the start-only mode instead of just checking if services are already running, always run a docker compose up or docker compose start which will not do anything if the services are already running but will recreate them if there were changes (when the start command is configured to up ) 2. Add a new option like restart-on-change which under the hood could just call docker compose up which already does this logic: if no changes, use already running service, if there are changes, recreate them. Although, there is a possible conflict here if someone configures the start command to be start instead of up but maybe that can be documented.

Comment From: sameerbsau

this is not a bug

Comment From: scottfrederick

Something like this was mentioned in a comment on another issue.

I don't think we could change the behavior of the start-only mode without potentially causing problems for users that rely on the way it currently works.

We could consider a new mode like restart that calls docker compose up without verifying services that are already running. restart-on-change would not be a good name for a Spring Boot mode, because it would imply that Boot inspects the docker-compose.yml file to look for changes, which we wouldn't want to do.

Comment From: mhalbritter

How about we add a property named spring.docker.compose.start.force, which, if set to true, forces the execution of the start command even if there are services running?

spring.docker.compose.start.force=true
spring.docker.compose.start.command=start

would start additional services.

spring.docker.compose.start.force=true
spring.docker.compose.start.command=up

would start additional services and restart existing services if their configuration changes.

I sketched that in https://github.com/mhalbritter/spring-boot/tree/mh/39749-restart-changed-services-in-docker-compose-when-using-start-only-lifecycle.

Comment From: mhalbritter

We talked about that, and we're going to add a new property spring.docker.compose.start.skip with possible enum values never and if_running.