G
G
great_772020-01-10 22:45:13
symfony
great_77, 2020-01-10 22:45:13

Can you give an example of setting up a connection in Symfony4 + Docker + Postgres?

An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "0.0.0.0" and accepting
TCP/IP connections on port 5432?

Mistake
An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused
  Is the server running on host "0.0.0.0" and accepting
  TCP/IP connections on port 5432?

  at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php:73
  at Doctrine\DBAL\Driver\AbstractPostgreSQLDriver->convertException('An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused	Is the server running on host "0.0.0.0" and accepting	TCP/IP connections on port 5432?', object(PDOException))
     (/var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:166)
  at Doctrine\DBAL\DBALException::wrapException(object(Driver), object(PDOException), 'An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused	Is the server running on host "0.0.0.0" and accepting	TCP/IP connections on port 5432?')
     (/var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:154)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
great_77, 2020-01-11
@great_77

env(DATABASE_URL): 'postgres://root:[email protected] simpledocker_db_1 /postgres' - container that we see when we use docker-compose ps

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question