Description
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
- run
docker-compose up
and my postgres and pgAdmin start - run the app everything works
- shut down the app
- docker compose containers are still running
case 2: docker compose not running before app
- start app, it starts docker compose up
- run the app everything works
- shutdown the app
- 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