Clarifying docs about database on the host machine.
This commit is contained in:
parent
02a3a7d8c1
commit
96e49a8fb5
|
@ -6,19 +6,21 @@
|
||||||
### PostgreSQL
|
### PostgreSQL
|
||||||
You need to make PostgreSQL listen not only `localhost`, but also Docker's network interface.
|
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
|
```ini
|
||||||
# Listen local interface and also Docker's network
|
# Listen local interface and also Docker's network
|
||||||
listen_addresses = 'localhost,172.17.0.1'
|
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
|
# Docker network
|
||||||
host all all 172.17.0.0/12 md5
|
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
|
```shell
|
||||||
systemctl restart postgresql@12-main.service
|
systemctl restart postgresql@12-main.service
|
||||||
|
|
Loading…
Reference in a new issue