From 96e49a8fb5672973652c26fb512bf7d85eb0ce81 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Sat, 19 Mar 2022 05:38:06 +0300 Subject: [PATCH] Clarifying docs about database on the host machine. --- _docs/access_database_on_host_from_docker.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/_docs/access_database_on_host_from_docker.md b/_docs/access_database_on_host_from_docker.md index af90f1c..b4de10e 100644 --- a/_docs/access_database_on_host_from_docker.md +++ b/_docs/access_database_on_host_from_docker.md @@ -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