Docker Community Forums

Share and learn in the Docker community.

Logical replication from Posgres on Windows to Postgres in docker container on Linux

Hi,

I’m using the bitnami/postgresql:latest image and I’m able to connect from a Win32 program (Delphi using the Unidac drivers) to PostgreSQL database running on Ubuntu server in a docker container.

The users will use a Win32 program to capture field survey data offline and then they want to replicate the data to the PostgreSQL database on Ubuntu server.

It seems to me I should use logical replication because a user may work with only a subset of the total master database on the Ubuntu server.

I must be able to do a mapping of the postgresql.conf and the pg_hba.conf files.
The part of my docker-compose.yml file to run PostgreSQL in a docker container:

  postgres:
    restart: unless-stopped
    container_name: postgres
    image: bitnami/postgresql:latest
    environment:
      - TZ="Africa/Johannesburg"
      - POSTGRES_DATABASE=sdb_risk
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=xxxxxxxxxxxxxxxx
    ports:
      - 5432:5432
      - 5433:5433
    volumes:
      - ./postgres_data:/bitnami/postgresql
#      - .pg_hba.conf:/bitnami/postgresql/conf/pg_hba.conf
#      - .postgresql.conf:/bitnami/postgresql/conf/postgresql.conf 
    networks:
      - dreamfactory-tier
      - app-tier

My question is: Am I on the right track to do a logical replication and if so, how do I map the pg_hba.conf and postgresql.conf files?

Regards,

Nols Smit

I’m not able to reproduce
(192.168.0.8 is the host’s IP, so the connection is [container]->[host]->[container]

$ docker run --rm --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 5432:5432 postgres
2b53de444c7e9b8c84039159c37c04be06c743cb3941359a17f8f769beb28c9e

$ docker run -it --rm postgres bash
root@64564e59b3fc:/# psql -h 192.168.0.8 -U postgres -d postgres
Password for user postgres:
psql (12.2 (Debian 12.2-2.pgdg100+1))
Type “help” for help.

postgres=#