PostgreSQL: Backup/Restore database from/to postgres docker.

PHOTO EMBED

Mon Aug 29 2022 15:47:38 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #bash

# Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql

# Restore:
cat your_dump.sql | docker exec -i your-db-container psql -U postgres
content_copyCOPY