Skip to content

symfony cli not setting port for dockerized postgresql db #472

Open
@naturefund-falk

Description

@naturefund-falk

I created a new symfony (7.0.7) webapp, created an entity and wanted to run symfony console doctrine:database:create. Output:
An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections?
Apparently the port number is wrong here. As i understood the symfony command, it should detect the real port number of the postgres container and then call the doctrine:database:create command. But it seems this is not happening. Running 'symfony run printenv' does not print anything related to the database.

The database is running inside docker (status=unhealthy, but running 'pg_isready -U ${POSTGRES_USER:-app}' inside the container is running ok and no error messages in logs).
Docker 26.1.1 is installed in rootless mode on a debian 12 system.
Symfony cli version is 5.8.16.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions