DEV Community

freecoderzhaoshuai
freecoderzhaoshuai

Posted on

3 1

Backup/Restore a dockerized PostgreSQL database

Backup your databases
docker exec -t your-db-container pg_dumpall -c -U postgres > dump_date +%d-%m-%Y"_"%H_%M_%S.sql

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

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay