Skip to content

Explain how Docker Compose support works when services are already running #36483

Closed
@asaikali

Description

@asaikali

In my testing of the docker compose functionality with spring boot 3.1.1 I noticed a very nice behaviour that seems to be the opposite of what the docs suggest will happen.

case 1: docker compose started before the app

  1. run docker-compose up and my postgres and pgAdmin start
  2. run the app everything works
  3. shut down the app
  4. docker compose containers are still running

case 2: docker compose not running before app

  1. start app, it starts docker compose up
  2. run the app everything works
  3. shutdown the app
  4. docker compose is shutdown

The docs at https://docs.spring.io/spring-boot/docs/3.1.1/reference/htmlsingle/#features.docker-compose.lifecycle imply that the default lifecycle is for docker compose down to be run on exit. I think docs are wrong as that is not the real world behaviour I am seeing.

It might also be useful in the lifecycle section of the docs to give an explanation of the difference between docker compose start and docker compose up since those are referenced in the text. I think many folks are not familiar with the subtle difference between up and start and I had to google it to learn about the difference. I found this stack overflow answer quite handy https://stackoverflow.com/a/56624718/438319

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions