Skip to content

spring-boot-docker-compose doesn't create service connections when image has registry host but not project #46971

@johnowl

Description

@johnowl

I'm using spring-boot-docker-compose to automatically start a Postgres database before my application tests start. With this docker compose file, everything works fine:

services:
  postgres:
    image: postgres:latest
    environment:
      - 'POSTGRES_DB=mydatabase'
      - 'POSTGRES_PASSWORD=secret'
      - 'POSTGRES_USER=myuser'
    ports:
      - '5432'

But if I add the registry host in the image field, the application doesn't start because it couldn't read the information to connect to the database. This is an example that make it fails:

services:
  postgres:
    image: docker.my-company.com/postgres:latest
    environment:
      - 'POSTGRES_DB=mydatabase'
      - 'POSTGRES_PASSWORD=secret'
      - 'POSTGRES_USER=myuser'
    ports:
      - '5432'

The log shows that the container started:

2025-08-27T15:56:04.917+02:00  INFO 11248 --- [           main] .s.b.d.c.l.DockerComposeLifecycleManager : Using Docker Compose file /Users/johnowl/Projects/company/application/compose.yml
2025-08-27T15:56:05.448+02:00  INFO 11248 --- [utReader-stderr] o.s.boot.docker.compose.core.DockerCli   :  Container application-postgres-1  Recreate
2025-08-27T15:56:05.493+02:00  INFO 11248 --- [utReader-stderr] o.s.boot.docker.compose.core.DockerCli   :  Container application-postgres-1  Recreated
2025-08-27T15:56:05.495+02:00  INFO 11248 --- [utReader-stderr] o.s.boot.docker.compose.core.DockerCli   :  Container application-postgres-1  Starting
2025-08-27T15:56:05.595+02:00  INFO 11248 --- [utReader-stderr] o.s.boot.docker.compose.core.DockerCli   :  Container application-postgres-1  Started
2025-08-27T15:56:05.596+02:00  INFO 11248 --- [utReader-stderr] o.s.boot.docker.compose.core.DockerCli   :  Container application-postgres-1  Waiting
2025-08-27T15:56:06.105+02:00  INFO 11248 --- [utReader-stderr] o.s.boot.docker.compose.core.DockerCli   :  Container application-postgres-1  Healthy
2025-08-27T15:56:06.832+02:00  INFO 11248 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data R2DBC repositories in DEFAULT mode.
2025-08-27T15:56:06.900+02:00  INFO 11248 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 65 ms. Found 2 R2DBC repository interfaces.

And then, I see this error:

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a ConnectionFactory: 'url' attribute is not specified and no embedded database could be configured.

Reason: Failed to determine a suitable R2DBC Connection URL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions