/postgresql

Centos7 (avkosme/centos) based postgresql image

Primary LanguageDockerfile

postgresql

Manual initialization db

$ /usr/pgsql-10/bin/postgresql-10-setup initdb
$ systemctl start postgresql-10

Create database, user

# CREATE DATABASE "dbname";
# CREATE USER "username" WITH ENCRYPTED PASSWORD 'password';
# GRANT ALL PRIVILEGES ON DATABASE "dbname" TO "username";
# ALTER DATABASE "dbname" OWNER TO "username";

Add permission (FOR STAGING ONLY)

Set in file /var/lib/pgsql/10/data/postgresql.conf

listen_addresses = '*'

Set in /var/lib/pgsql/10/data/pg_hba.conf

host  all all 0.0.0.0/0 trust

Backup

$ pg_dump -h localhost -U username -d dbname > `date +%Y-%m-%d_%H:%M`-backup.sql

Restore

$ psql dbname < data_base_dump.sql