# Docker dev database ownership and strange path problems

**URL:** <https://meta.discourse.org/t/docker-dev-database-ownership-and-strange-path-problems/75926>\
**Category:** Development\
**Created:** [13 Diciembre, 2017 00:43 UTC](https://meta.discourse.org/t/docker-dev-database-ownership-and-strange-path-problems/75926 "2017-12-13T00:43:53Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![ryanerwin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryanerwin/32/94589_2.png) [@ryanerwin](https://meta.discourse.org/u/ryanerwin)\
**Post date:** [19 Octubre, 2018 17:22 UTC](https://meta.discourse.org/t/docker-dev-database-ownership-and-strange-path-problems/75926/9 "2018-10-19T17:22:44Z")

</div>

> [@pfaffman](#):
>
> ```plaintext
> [2017-12-14 20:53:31] pg_dump: [archiver (db)] connection to database "discourse_development" failed: FATAL: Peer authentication failed for user "postgres"
> 
> ```

I ran into this same error… it’s a bit more obscure when you hit it during `restore` because of the errors about `no metadata to extract` and `cannot restore into different schema` make it less obvious that the real problem is `FATAL: Peer authentication failed for user "postgres"`.

Any reason not to update `data/postgres/pg_hba.conf` method from `peer` to `trust` for the default dev image?

> [@pfaffman](#):
>
> ’ve solved this by `bin/docker/shell_root` and editing `/etc/postgresql/9.5/main/pg_hba.conf` , changing “peer” to “trust” and restarting the container (one day I’ll figure out how to restart postgres from within the container).

The config file has moved, now is:

`/etc/postgresql/10/main/pg_hba.conf` (inside container)  
`data/postgres/pg_hba.conf` (on host)

When complete, restart the service in the container with:  
`sv restart postgres`

Unfortunately, I’m still unable to complete a restore… After the `create index` are all complete I’m getting:

```plaintext
[2018-10-19 17:14:32] EXCEPTION: PG::InsufficientPrivilege: ERROR: permission denied for relation schema_migrations
: SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC

```

But when I run that query via `./bin/docker/psql` I’m just getting an empty set, not a Postgres “Insufficient Priviliges” error…

```plaintext
discourse-# \c discourse_development ;
You are now connected to database "discourse_development" as user "postgres".
discourse_development-# SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
discourse_development-# \c discourse;
You are now connected to database "discourse" as user "postgres".
discourse-# SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC

```

Maybe there’s something else I should change in `pg_hba.conf`? @sam

---

_[View the full topic](https://meta.discourse.org/t/docker-dev-database-ownership-and-strange-path-problems/75926)._
