# Backup fails on localhost with docker

**URL:** https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015
**Category:** Development
**Created:** [July 5, 2021, 7:37am UTC](https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015 "2021-07-05T07:37:47Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![max-elia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/max-elia/32/225853_2.png) [@max-elia](https://meta.discourse.org/u/max-elia)
#### Post date: [July 5, 2021, 7:37am UTC](https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015/1 "2021-07-05T07:37:47Z")

</div>

I’m having issues with creating a backup from the admin section, running discourse from the docker container on localhost.

The error I’m getting is:  
`pg_dump: error: connection to database "discourse development" failed: FATAL: Peer authentication failed for user "postgres".`

I checked the pg\_hba.conf file, and have all options set to trust.

Would be great if I could get some assistance on how to get this to work.

I tried on Ubuntu as well as on MacOSX. Everything else from the discourse instance is working fine on both (creating Posts, API…) except for the backup functionality.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 5, 2021, 10:31am UTC](https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015/2 "2021-07-05T10:31:06Z")

</div>

That could be a regression. It should be using user discourse, I’d think.

---

<div class="post-metadata">

### Author: ![max-elia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/max-elia/32/225853_2.png) [@max-elia](https://meta.discourse.org/u/max-elia)
#### Post date: [July 5, 2021, 10:52am UTC](https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015/3 "2021-07-05T10:52:46Z")

</div>

Where could I change the user being used by discourse?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 5, 2021, 11:50am UTC](https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015/4 "2021-07-05T11:50:20Z")

</div>

How did you install?

---

<div class="post-metadata">

### Author: ![max-elia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/max-elia/32/225853_2.png) [@max-elia](https://meta.discourse.org/u/max-elia)
#### Post date: [July 5, 2021, 1:15pm UTC](https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015/5 "2021-07-05T13:15:29Z")

</div>

Following this tutorial:

> [@Install Discourse for development using Docker](https://meta.discourse.org/t/beginners-guide-to-install-discourse-for-development-using-docker/102009):
>
> Developing using Docker Since Discourse runs in Docker, you should be able to run Discourse directly from your source directory using a Discourse development container. white_check_mark Pros: No need to install any system dependencies, no configuration needed at all for setting up a development environment quickly. x Cons: Will be slightly slower than the native dev environment on Ubuntu, and much slower than a native install on MacOS. See also [Developing Discourse using a Dev Container](https://meta.discourse.org/t/developing-discourse-using-a-dev-container/336366) …

As I said, everything works fine, except for the backup.

---

<div class="post-metadata">

### Author: ![dmc](https://avatars.discourse-cdn.com/v4/letter/d/839c29/32.png) [@dmc](https://meta.discourse.org/u/dmc)
#### Post date: [September 5, 2021, 2:27am UTC](https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015/6 "2021-09-05T02:27:22Z")

</div>

Hi Max! Were you able to fix this issue?  
I’m currently having the exact same problem, although I first detected it trying to make a restore on my local docker development install.

---

<div class="post-metadata">

### Author: ![natasha\_selvidge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natasha_selvidge/32/235894_2.png) [@natasha\_selvidge](https://meta.discourse.org/u/natasha_selvidge)
#### Post date: [October 8, 2021, 9:21pm UTC](https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015/7 "2021-10-08T21:21:08Z")

</div>

Hi @max-elia I’ve also run into this problem, were you able to get it fixed by any chance?

---

<div class="post-metadata">

### Author: ![natasha\_selvidge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natasha_selvidge/32/235894_2.png) [@natasha\_selvidge](https://meta.discourse.org/u/natasha_selvidge)
#### Post date: [October 9, 2021, 7:04pm UTC](https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015/8 "2021-10-09T19:04:23Z")

</div>

I fixed it by adding username: discourse directly into my database.yml. Thank you!

---

<div class="post-metadata">

### Author: ![helmi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/helmi/32/114772_2.png) [@helmi](https://meta.discourse.org/u/helmi)
#### Post date: [October 13, 2021, 8:24pm UTC](https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015/9 "2021-10-13T20:24:58Z")

</div>

where in the file did you add it and what else did you do?? Adding it to the development section and simply restarting (`d/shutdown_dev; d/boot_dev`) didn’t do it for me.

---

<div class="post-metadata">

### Author: ![natasha\_selvidge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natasha_selvidge/32/235894_2.png) [@natasha\_selvidge](https://meta.discourse.org/u/natasha_selvidge)
#### Post date: [October 13, 2021, 8:58pm UTC](https://meta.discourse.org/t/backup-fails-on-localhost-with-docker/196015/10 "2021-10-13T20:58:02Z")

</div>

Right under `adapter: postgresql` in the config/database.yml Then I followed the `script/discourse restore <filename.of.the.backup.tar.gz>` Which was what I was trying to accomplish.
