Сегодня мне требуется более 2 часов, чтобы понять это с помощью моих коллег.

  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. Запустите docker-compose up

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

5. Скопируйте файл с помощью докера

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

6. Убить существующие постгресы

docker-compose -f docker-compose-env.yml kill postgres

7. Запустите uppostgres снова

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

8. Проверяем, работает ли

psql -h localhost -p 5433 -U {username_db}
--> sql (10.16 (Ubuntu 10.16-0ubuntu0.18.04.1), server 11.11 (Debian 11.11-1.pgdg90+1))
WARNING: psql major version 10, server major version 11.
         Some psql features might not work.
Type "help" for help.
{username}=# exit

Вот и все.

Надеюсь, поможет