# Backup restore failing on clean dev docker env: FATAL: Peer authentication failed for user “postgres”

**URL:** <https://meta.discourse.org/t/backup-restore-failing-on-clean-dev-docker-env-fatal-peer-authentication-failed-for-user-postgres/208170>\
**Category:** Bug\
**Tags:** pr-welcome, dev-install\
**Created:** [November 3, 2021, 9:22pm UTC](https://meta.discourse.org/t/backup-restore-failing-on-clean-dev-docker-env-fatal-peer-authentication-failed-for-user-postgres/208170 "2021-11-03T21:22:05Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![koen360](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/koen360/32/194302_2.png) [@koen360](https://meta.discourse.org/u/koen360)\
**Post date:** [November 3, 2021, 9:22pm UTC](https://meta.discourse.org/t/backup-restore-failing-on-clean-dev-docker-env-fatal-peer-authentication-failed-for-user-postgres/208170/1 "2021-11-03T21:22:05Z")

</div>

Hi over in [the beginners guide to install discourse for development using docker](https://meta.discourse.org/t/beginners-guide-to-install-discourse-for-development-using-docker/102009) some of the comments mention this issue which I think is actually a bug that should be raised as such here. Correct me if I am wrong.

I tend to create a copy of production to test major config changes and have many times created a clean slate like this before. However now the backups fail with this error conerning the peer authentication failing.

Just to provide context on what I am doing (wrong potentially)

1. delete the local discourse directory altogether
2. stop and remove any containers
3. start fresh git cloning discourse and also the plugins I use directly after in the plugins directory
4. do the boot\_dev --init incantations, bundle install if needed, migrate database if needed.
5. with the dummy admin account i log in, upload the backup I downloaded from my live site
6. hit restore backup.

Let me know if I can provide anymore info. The backup logs are below. And oh yes, I checked the `pg_hba.conf` in `data/postgres/` had all the authentication methods set to “trust”.

```plaintext
[2021-11-03 20:55:35] 'koen' has started the restore!
[2021-11-03 20:55:35] Marking restore as running...
[2021-11-03 20:55:35] Making sure /src/tmp/restores/default/2021-11-03-205535 exists...
[2021-11-03 20:55:35] Copying archive to tmp directory...
[2021-11-03 20:55:35] Extracting dump file...
[2021-11-03 20:55:36] Validating metadata...
[2021-11-03 20:55:36] Current version: 20211022154420
[2021-11-03 20:55:36] Restored version: 20211022154420
[2021-11-03 20:55:36] Enabling readonly mode...
[2021-11-03 20:55:36] Pausing sidekiq...
[2021-11-03 20:55:36] Waiting up to 60 seconds for Sidekiq to finish running jobs...
[2021-11-03 20:55:42] Creating missing functions in the discourse_functions schema...
[2021-11-03 20:55:42] Restoring dump file... (this may take a while)
[2021-11-03 20:55:42] psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"
[2021-11-03 20:55:42] EXCEPTION: psql failed: psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"
[2021-11-03 20:55:42] /src/lib/backup_restore/database_restorer.rb:92:in `restore_dump'
/src/lib/backup_restore/database_restorer.rb:26:in `restore'
/src/lib/backup_restore/restorer.rb:51:in `run'
/src/script/spawn_backup_restore.rb:23:in `restore'
/src/script/spawn_backup_restore.rb:36:in `block in <main>'
/src/script/spawn_backup_restore.rb:4:in `fork'
/src/script/spawn_backup_restore.rb:4:in `<main>'
[2021-11-03 20:55:42] Trying to rollback...
[2021-11-03 20:55:42] There was no need to rollback
[2021-11-03 20:55:42] Cleaning stuff up...
[2021-11-03 20:55:42] Dropping functions from the discourse_functions schema...
[2021-11-03 20:55:42] Removing tmp '/src/tmp/restores/default/2021-11-03-205535' directory...
[2021-11-03 20:55:42] Unpausing sidekiq...
[2021-11-03 20:55:42] Marking restore as finished...
[2021-11-03 20:55:42] Notifying 'koen' of the end of the restore...
[2021-11-03 20:55:46] Finished!

```

---

_[View the full topic](https://meta.discourse.org/t/backup-restore-failing-on-clean-dev-docker-env-fatal-peer-authentication-failed-for-user-postgres/208170)._
