Docker Repository - bfren ecosystem
PostgreSQL comes pre-installed (12, 13, 14 or 15) with automatic backups built-in.
Backups for every database are stored:
- in the
/backupvolume - in subfolders by date and time (yyMMddhhmm)
- every eight hours
See For Backups for configuration variables.
- 5432
| Volume | Purpose |
|---|---|
/data | Data files. |
/backup | Backup files (also used for export / import scripts - see helper functions). |
| Variable | Values | Description | Default |
|---|---|---|---|
POSTGRESQL_BACKUP_COMPRESS_FILES | 0 or 1 | Whether or not to compress backup files (using gzip). | 0 |
POSTGRESQL_BACKUP_KEEP_FOR_DAYS | 0: keep forever Num: days | How many days to keep backups before auto-deleting them. | 14 |
| Variable | Values | Description | Default |
|---|---|---|---|
POSTGRESQL_USERNAME | string | Application username - will be used as database name if POSTGRESQL_DATABASE is not set. | None - required |
POSTGRESQL_PASSWORD | string | Application password. | None - required |
POSTGRESQL_DATABASE | string | Database name(s) - multiple databases can be separated by a comma. | None |
| Function | Purpose | Usage |
|---|---|---|
db-backup | Run backup manually. | docker exec <<CONTAINER>> db-backup |
db-exists | Echoes '0' or '1' depending on whether or not the specified database exists on the server. | docker exec <<CONTAINER>> db-exists "foo" |
db-export | Dumps the specified database as a SQL file to the root of the /backup volume. | docker exec <<CONTAINER>> db-export <<DB_NAME>> |
db-import | Executes all files in the root of the /backup volume. | docker exec <<CONTAINER>> db-import |
db-restore | Deletes all files in /data volume, then shuts container down - on restart, the container will restore from the specified backup. | docker exec <<CONTAINER>> db-restore 202107180500 |
db-stop | Stops the database server (will automatically terminate the container). | docker exec <<CONTAINER>> db-stop |
Copyright (c) 2021-2023 bfren (unless otherwise stated)