Clarifying docs about database on the host machine.

This commit is contained in:
Alexey Skobkin 2022-03-19 05:38:06 +03:00
parent 02a3a7d8c1
commit 96e49a8fb5
1 changed files with 5 additions and 3 deletions

View File

@ -6,19 +6,21 @@
### PostgreSQL
You need to make PostgreSQL listen not only `localhost`, but also Docker's network interface.
To do that you need to add host machine IP address in the Docker network (usually `172.17.0.1`) to the `postgresql.conf`:
To do that you need to add host machine IP address in the Docker network (usually `172.17.0.1`) to the
`postgresql.conf` by changing `listen_addresses` parameter:
```ini
# Listen local interface and also Docker's network
listen_addresses = 'localhost,172.17.0.1'
```
Then you need to allow apps inside Docker containers to authenticate. That could be done in the `pg_hba.conf`:
Then you need to allow apps inside Docker containers to authenticate. That could be done by adding following line to the
`pg_hba.conf`:
```
# Docker network
host all all 172.17.0.0/12 md5
```
Do not forget to restart your PostgreSQL server. For PostgreSQL 12 it could be usually done like that:
Do not forget to restart your PostgreSQL server. For PostgreSQL 12 and `main` cluster it could be usually done like that:
```shell
systemctl restart postgresql@12-main.service