# Create, download, and restore a backup of your Discourse database

**URL:** https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710
**Category:** Self-Hosting
**Tags:** backups, how-to
**Created:** [11 juli 2019 om 18:39 UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710 "2019-07-11T18:39:08Z")
**Posts on this page:** 1
**Showing post:** 47

<div class="post-metadata">

### Author: ![das-g](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/das-g/32/441608_2.png) [@das-g](https://meta.discourse.org/u/das-g)
#### Post date: [4 september 2024 om 15:27 UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/47 "2024-09-04T15:27:45Z")

</div>

Is this also possible in a Docker development environment, set up as outlined at [Install Discourse for development using Docker](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009)?

When I try it as described in the section [Create a backup](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710#p-603469-create-a-backup-1) above, I get the error `pg_dump: error: connection to database "discourse_development" failed: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"`.

> **Full log of the failed backup**
>
> ```plaintext
> [2024-09-04 15:03:39] [STARTED]
> [2024-09-04 15:03:39] 'raphael.dasgupta' has started the backup!
> [2024-09-04 15:03:39] Marking backup as running...
> [2024-09-04 15:03:39] Making sure '/src/tmp/backups/default/2024-09-04-150339' exists...
> [2024-09-04 15:03:39] Making sure '/src/public/backups/default' exists...
> [2024-09-04 15:03:39] Updating metadata...
> [2024-09-04 15:03:39] Dumping the public schema of the database...
> [2024-09-04 15:03:40] pg_dump: error: connection to database "discourse_development" failed: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"
> [2024-09-04 15:03:40] EXCEPTION: pg_dump failed
> [2024-09-04 15:03:40] /src/lib/backup_restore/backuper.rb:173:in `dump_public_schema'
> /src/lib/backup_restore/backuper.rb:36:in `run'
> /src/script/spawn_backup_restore.rb:9:in `backup'
> /src/script/spawn_backup_restore.rb:31:in `block in <main>'
> /src/script/spawn_backup_restore.rb:4:in `fork'
> /src/script/spawn_backup_restore.rb:4:in `<main>'
> [2024-09-04 15:03:40] Cleaning stuff up...
> [2024-09-04 15:03:40] Removing '.tar' leftovers...
> [2024-09-04 15:03:40] Marking backup as finished...
> [2024-09-04 15:03:40] Notifying 'raphael.dasgupta' of the end of the backup...
> 
> ```

---

_[View the full topic](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710)._
