anpleenko
10/5/2018 - 4:13 PM

Backup/restore postgres in docker container

Backup/restore postgres in docker container

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 -Upostgres