Sign inSign up

monusiddiki/postgres-backup:latest

Manifest digest

sha256:f725e54ad4dc94188cc75addd628a37ea0098c7fe2120e3bc9ca617d716f7a76

Last pushed

about 2 months by monusiddiki

Type

Compose

Manifest digest

sha256:f725e54ad4dc94188cc75addd628a37ea0098c7fe2120e3bc9ca617d716f7a76

Compose file content

services:

  postgres_backup:
    image: prodrigestivill/postgres-backup-local:16
    container_name: postgres_backup
    restart: always
    environment:
        
      # Timezone configuration
      TZ: Asia/Kathmandu
      
      # Connects directly to the postgres service over the internal network
      POSTGRES_HOST: ${POSTGRES_HOST}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      
      #You can give multiple also
      POSTGRES_DB: ${POSTGRES_DB}
      
      # Cron schedule (e.g., daily at midnight)
      SCHEDULE: ${BACKUP_CRON}
      
      POSTGRES_EXTRA_OPTS: ${POSTGRES_EXTRA_OPTS}
      
      # Boolean value ..i.e either start backup when first start
      BACKUP_ON_START: ${BACKUP_ON_START}
      
      # Number of days to keep backups before deleting them
      BACKUP_KEEP_DAYS: ${BACKUP_KEEP_DAYS}
      
      BACKUP_KEEP_WEEKS: ${BACKUP_KEEP_WEEKS}
      BACKUP_KEEP_MONTHS: ${BACKUP_KEEP_MONTHS}
      HEALTHCHECK_PORT: ${HEALTHCHECK_PORT}
      
    volumes:
      # Mounts a local host directory to store the actual backup files
      - ./pg-backups:/backups
      
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "3"

Docker commands

docker compose -f oci://monusiddiki/postgres-backup:latest up

Use the above command to pull and run the Compose file. Learn more.

Images used

Image

Backup PostgresSQL to local filesystem with periodic backups and rotate backups.


Pulls

10M+

Stars

64

Last Updated

12 months