With docker compose down you can control if volumes should be removed or not through -v flag.

Docker Compose support has stop command configuration through spring.docker.compose.stop.command, but when stop is replaced with down, the volumes are not removed and it is not possible to change this behavior.

Please add property to control this. This would give us "H2 like" experience, but with non-embedded database.

Sample expected configuration:

spring:
  docker:
    compose:
      file: compose-database.yml
      profiles:
        active: dev
      stop:
        command: down
        remove-volumes: true #THIS
  jpa:
    hibernate:
      ddl-auto: validate
  sql:
    init:
      mode: always

or more universal, because other flags could be used as well:

spring:
  docker:
    compose:
      file: compose-database.yml
      profiles:
        active: dev
      stop:
        command: down -v --rmi all
  jpa:
    hibernate:
      ddl-auto: validate
  sql:
    init:
      mode: always

Comment From: scottfrederick

Thanks for the suggestion. This duplicates #38763.