Backup/Restore a dockerized PostgreSQL database

后端 未结 10 1893
[愿得一人]
[愿得一人] 2020-12-22 15:50

I\'m trying to backup/restore a PostgreSQL database as is explained on the Docker website, but the data is not restored.

The volumes used by the database image are:<

10条回答
  •  自闭症患者
    2020-12-22 16:16

    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
    

提交回复
热议问题