0

I'm using the demo database. But airflow is running with docker-compose. I inserted the true information but i still have this error.

enter image description here

QDex
  • 139
  • 9
  • In Docker Compose, you can use the service name to connect to one container from another container. So if your Postgres DB service is named `postgres`, the hostname from the Airflow container will be `postgres`, not `localhost`. – Bas Harenslak Nov 16 '21 at 11:34
  • The database demo is not runing on docker-compose. It's running on localhost. – QDex Nov 16 '21 at 11:37
  • In that case, you're looking to access a port on your host machine. There are different ways to handle that. Two options are to connect to `host.docker.internal` ([docs](https://docs.docker.com/desktop/mac/networking)), or set `network_mode: host` in your docker-compose file. – Bas Harenslak Nov 16 '21 at 12:22
  • I use to start airflow with `docker-compose up`. But now if I want to access a port on localhost, must I write `docker-compose up -d -P --name ` ??? – QDex Nov 16 '21 at 13:37
  • I set it `network_mode: host` but still not working. – QDex Nov 16 '21 at 19:35

1 Answers1

0

Everything work fine. I read this and it help me : https://dba.stackexchange.com/questions/83984/connect-to-postgresql-server-fatal-no-pg-hba-conf-entry-for-host

According to that, I edited the file /etc/postgresql/14/main/postgresql.conf and also the file /etc/postgresql/14/main/pg_hba.conf

QDex
  • 139
  • 9