Member-only story

Publish postgres port to network

Today it takes me more than 2 hours to figure this out, with the help of my colleagues.

Donald Le
1 min readMar 31, 2021
Photo by Charles Etoroma on Unsplash
  1. pg_hba.conf
local   all             all                                     trust

host all all 127.0.0.1/32 trust

host all all ::1/128 trust
host all all 0.0.0.0/0 trust

local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust

2. postgresql.conf

listen_addresses = '*'

3.docker-compose.yml

postgres:
image: postgis/postgis:11-2.5
networks:
- bagdb
volumes:
- postgres:/var/lib/postgresql/data
ports:
- "5433:5432"

4. Run docker-compose up

docker-compose -f docker-compose-env.yml up -d

5. Copy file using docker

docker cp pg_hba.conf {container_name}:{location_pg_hba}

6. Kill exisitng postgres

docker-compose -f docker-compose-env.yml…

--

--

Donald Le
Donald Le

Written by Donald Le

A passionate automation engineer who strongly believes in “A man can do anything he wants if he puts in the work”.

No responses yet