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
It is unclear that Docker Compose services have not been started as one or more is already running #38398
Comments
This behavior is intentional. We tried to clarify the documentation in #36483.
You can still do this if you then stop the container before starting the app.
That may not be what the user wants and restarting may lose a non-persistent change that had been made to the container. If we want to support something in this area, I think we'd have to offer a configuration option and make restarting already running containers an opt-in feature. |
I agree. Could we provide clearer error messages or warning log for services are partially running? |
Spring Boot does not parse the compose YAML file so we don't know how many services should be running. All we can easily detect at the moment is that one or more services is running. Given this, I think an error or warning would be too much. We could perhaps log an info level message indicating that the services won't be started as one or more is already running. We'll discuss this as a team and decide what, if anything, we want to do. |
We could use the compose config command to detect that not all defined services are running (we do that for
That's fine for me. |
Version:
spring-boot-docker-compose:3.1.2
I have created a project using
spring-boot-docker-compose
that lists three services (let's call them A, B, and C) in thecompose.yml
file. Everything works as expected on the first launch.However, after the containers are created, if I manually start the container for service A using the Docker API (
docker start $service_A_container_id
), and then attempt to start the Spring application again without first stopping it, the spring-boot-docker-compose skips the container startup phase. This results in services B and C not being started correctly.Upon inspecting the code, I found the cause of this issue lies in the condition used to determine whether the Docker API should be called in
org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager#start
:This condition stipulates that no currently running services should be found.
I believe the startup phase should not be skipped in this scenario for the following reasons:
The text was updated successfully, but these errors were encountered: