Whilst trying the new spring-boot-docker-compose module, I ran into an issue in the Gitlab pipeline. Previously I used testcontainers to spin up the container environment. This pipeline is setup with a Docker-in-Docker configuration, so docker runs as a separate service. In testcontainers it is possible to start the containers with new DockerComposeContainer().withLocalCompose(false); to run in the Gitlab pipeline. Currently it’s not possible to configure spring-boot-docker-compose to use this external docker instance to run docker compose. Would it be possible to make the docker host configurable?

Comment From: wilkinsona

Thanks for trying the new module.

Spring Boot's Docker Compose integration is intended as a development-time feature. As such, supporting it in a CI pipeline hasn't really been considered and is unlikely to be something that we will invest in I'm afraid. It may be possible to get it to work but your CI environment will have to have the docker compose CLI available.

If you're looking for support for container-based services for tests, Spring Boot's Testcontainers integration is likely to be a much better fit. There's also the option to use Testcontainers at development time if you wish.

Comment From: jarivandam

Thanks for the quick response. I will take a look at the Spring Boot Testcontainers integration and see if that would improve our current setup.

Comment From: instagregt

@jarivandam did you find a good solution for it?

What we did:

  1. Start postgresql container with docker command in "run" section in github pipeline
  2. the integration test has been set to go against a test database
  3. test database is created with -v ${{ github.workspace }}/util/initialize_databases.sql:/docker-entrypoint-initdb.d/initialize_databases.sql \

I also think that it would be nice if the same database you setup locally with compose.yml could be triggered by @SpringBootTest - Maybe via an option.