How to setup full and incremental backups in docker container with postgres

I am trying to figure out how to start docker container with additional options to make incremental backups
I tried somehow to fill some enviroment variables, but it didn’t work (obviously)

    container_name: database
    image: $HOST/postgres:$POSTGRES_TAG
    restart: always
    labels:
      co.elastic.metrics/raw: "[{\"enabled\":true,\"metricsets\":[\"database\",\"bgwriter\",\"activity\",\"statement\"],\"module\":\"postgresql\",\"hosts\":[\"postgres://localhost:5432?sslmode=disable\"],\"username\":\"postgres\",\"password\":\"$DB_PASS\"}]"
    environment:
      POSTGRES_DB: portal
      POSTGRES_PASSWORD: $DB_PASS
      POSTGRES_HOST_AUTH_METHOD: 'local replication all trust'
      POSTGRES_WAL_LEVEL: 'replica'
      POSTGRES_ARCHIVE_MODE: 'on'
      POSTGRES_ARCHIVE_TIMEOUT: 60
      POSTGRES_MAX_WAL_SENDERS: 5
    ports:
      - "5432:5432"
    volumes:
      - /var/lib/postgresql/data:/var/lib/postgresql/data

How I can setup making incremental backups (wal) inside docker container?

Not quite sure if this is what you are looking for, but in the docs for the bitnami/postgresql image it is explained how to setup master-slave replication (scroll down to “Setting up a streaming replication”).

1 Like