Skip to content

A handy Docker container to periodically backup PostgreSQL to Alibaba Cloud Object Storage Service (OSS)

License

Notifications You must be signed in to change notification settings

isaced/postgres-backup-oss

Repository files navigation

postgres-backup-oss

Docker

English | 简体中文

This project provides Docker images to periodically back up a PostgreSQL database to Alibaba Cloud Object Storage Service (OSS).

Features

  • Minimal image size (15MB)
  • Low memory usage (less than 1MB in idle state)
  • Support custom scheduling interval time (with cron format)

Usage

Create a docker-compose.yml file with the following content:

services: postgres: image: postgres:16 environment: POSTGRES_USER: user POSTGRES_PASSWORD: password POSTGRES_DB: dbname backup: image: isaced/postgres-backup-oss:latest depends_on: - postgres environment: SCHEDULE: '0 0 * * *' # optional, default '0 0 * * *' (daily) POSTGRES_HOST: postgres POSTGRES_PORT: 5432 # optional, default 5432 POSTGRES_DATABASE: dbname POSTGRES_USER: user POSTGRES_PASSWORD: password OSS_BUCKET_NAME: ${OSS_BUCKET_NAME} OSS_REGION: ${OSS_REGION} OSS_ACCESS_KEY_ID: ${OSS_ACCESS_KEY_ID} OSS_ACCESS_KEY_SECRET: ${OSS_ACCESS_KEY_SECRET}

Then run docker-compose up -d to start the backup service.

OSS Configuration

You need to create an OSS bucket and an AccessKey pair in the Alibaba Cloud console. Then fill in the environment variables in the docker-compose.yml file.

About more OSS configuration, please refer to:Configure ossutil - Environment variables, just add to environment to take effect.

About

A handy Docker container to periodically backup PostgreSQL to Alibaba Cloud Object Storage Service (OSS)

Resources

License

Stars

Watchers

Forks

Packages