Docker image for postgres
extended with management bash scripts.
To build the images and push them to the registry:
make build
make push
Example of a docker-compose.yml
file that uses this image:
version: '3'
volumes:
postgres_data: {}
postgres_backups: {}
services:
service:
image: service:latest
command: ./start
postgres:
image: marcosgabarda/postgres:latest
volumes:
- postgres_data:/var/lib/postgresql/data
- postgres_backups:/backups
env_file:
- ./.env
This images adds commands to the original PostgreSQL image for maintenance proposes.
Creates a backup of the database. Usage:
$ docker compose -f <environment>.yml (exec |run --rm) postgres backup
Views a list of all created backups of the database. Usage:
$ docker compose -f <environment>.yml (exec |run --rm) postgres backups
Creates a read only user. Usage:
$ docker compose -f <environment>.yml (exec |run --rm) postgres createreaduser
Restores the indicated database backup. Usage:
$ docker compose -f <environment>.yml (exec |run --rm) postgres restore <1>
Parameters:
<1>
filename of an existing backup.