Description: Requesting support for an option to create a random project name in Docker Compose within the spring-boot-docker-compose project. This feature would enable running gradle test with multiple forks simultaneously.

Current Behavior: The current configuration chooses automatically the default, which is the folder containing the docker-compose.yml, as project name.

Proposed Enhancement: Introduce a new property spring.docker.compose.random-project : Boolean to allow random Docker Compose project names.

Comment From: mhalbritter

We talked about this and decided to add a property to set the Docker Compose project name. This property would get passed to docker compose via the --project-name argument.

With the new property in place, you could use the RandomValuePropertySource to use a random project name.

Comment From: mhalbritter

Side note: I tried to workaround by specifying spring.docker.compose.start.arguments=--project-name=${random.uuid} (using this new feature) but this doesn't work as docker compose wants the --project-name before the up subcommand. We currently only allow the arguments after start and stop to be specified. I think we should also allow the arguments before the subcommands to be specified, with the property spring.docker.compose.arguments maybe? I've opened #42500 for that.

Comment From: mhalbritter

Closing this in favor of https://github.com/spring-projects/spring-boot/issues/42500, which is the more general solution.

Comment From: mhalbritter

With #42571 merged, you can now set

spring.docker.compose.arguments=--project-name=${random.uuid}

to get a random project name.