# CircleCI Postgres Image suddenly causing problems? "role postgres not found"

**URL:** <https://discuss.circleci.com/t/circleci-postgres-image-suddenly-causing-problems-role-postgres-not-found/25044>\
**Category:** Build Environment\
**Created:** [September 11, 2018, 3:44pm UTC](https://discuss.circleci.com/t/circleci-postgres-image-suddenly-causing-problems-role-postgres-not-found/25044 "2018-09-11T15:44:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/felicianotech/32/21348_2.png) [@FelicianoTech](https://discuss.circleci.com/u/FelicianoTech)\
**Post date:** [September 11, 2018, 3:44pm UTC](https://discuss.circleci.com/t/circleci-postgres-image-suddenly-causing-problems-role-postgres-not-found/25044/1 "2018-09-11T15:44:38Z")

</div>

**Update:** To conform with upstream, we’ve removed our default `root` role/user so that the `postgres` role/user is automatically created. See [this](https://discuss.circleci.com/t/convenience-images-update-removing-hardcoded-postgres-user/25054). The **TL;DR** is if you were using `root` as your user, either create it via config or use `postgres` as the user.

* * *

Hey everyone,

Here’s what’s going on and what caused it.

## The Problem

Most of the CircleCI Docker Convenience Images are small CI tweaks we apply to the upstream Docker Library images. So the `circleci/postgres` image is based on the `postgres` image.

4 days ago the upstream maintainers [made a small tweak](https://github.com/docker-library/postgres/commit/0aff40cb72f4f5968a1bb4cb04e2fc6f1ce8857e) to the image so that the `postgres` role/user is only created when the `POSTGRES_USER` is not set. So of course, we set it to `root`. This has caused `circleci/postgres` images built within the last few days to no longer have the `postgres` role.

## The Solution

There’s 3 quick solutions:

1. There’s already a `root` PostgreSQL role/user in the image. You can change your DB creds to use that instead of `postgres`.
2. Set the `POSTGRES_USER` environment variable in your CircleCI config to `postgres` and you’ll get the role back in the image as it was before. This would be done something like this:

```auto
      - image: circleci/postgres:9.6-alpine
        environment:
          POSTGRES_USER: postgres

```

3. Use the upstream image directly (e.g. `postgres:9.6`). Keep in mind certain utilities that CircleCI features need might not be installed.

---

<div class="post-metadata">

**Author:** ![tobypinder](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/tobypinder/32/23047_2.png) [@tobypinder](https://discuss.circleci.com/u/tobypinder)\
**Post date:** [September 11, 2018, 4:26pm UTC](https://discuss.circleci.com/t/circleci-postgres-image-suddenly-causing-problems-role-postgres-not-found/25044/2 "2018-09-11T16:26:40Z")

</div>

Thank you very much for the detailed information here, we were actually in the middle of writing up the issue as a ticket. We’ve been able to fix all affected `circleci` configurations with `Option 2` above, and everything is now functioning as expected.

---

<div class="post-metadata">

**Author:** ![rose](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rose/32/7816_2.png) [@rose](https://discuss.circleci.com/u/rose)\
**Post date:** [September 11, 2018, 7:09pm UTC](https://discuss.circleci.com/t/circleci-postgres-image-suddenly-causing-problems-role-postgres-not-found/25044/3 "2018-09-11T19:09:42Z")

</div>

Glad to hear that! @tobypinder

We’re now publishing changes that should mitigate this issue, as well:

[https://discuss.circleci.com/t/convenience-images-update-removing-hardcoded-postgres-user](https://discuss.circleci.com/t/convenience-images-update-removing-hardcoded-postgres-user)

---

<div class="post-metadata">

**Author:** ![mozz100](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/mozz100/32/19137_2.png) [@mozz100](https://discuss.circleci.com/u/mozz100)\
**Post date:** [September 12, 2018, 10:34am UTC](https://discuss.circleci.com/t/circleci-postgres-image-suddenly-causing-problems-role-postgres-not-found/25044/4 "2018-09-12T10:34:00Z")

</div>

@FelicianoTech I think the removal of the default `root` user warrants an update to the documentation on [https://hub.docker.com/r/circleci/postgres/](https://hub.docker.com/r/circleci/postgres/) - if you agree, please could you update?

That page still implies that the `root` user is created. If I understand correctly, that’s no longer true. In fact, the `postgres` user will get created by default (in the absence of the `POSTGRES_USER` env var).

---

<div class="post-metadata">

**Author:** ![Cormac](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/cormac/32/18955_2.png) [@Cormac](https://discuss.circleci.com/u/Cormac)\
**Post date:** [September 12, 2018, 12:07pm UTC](https://discuss.circleci.com/t/circleci-postgres-image-suddenly-causing-problems-role-postgres-not-found/25044/5 "2018-09-12T12:07:39Z")

</div>

I will go ahead and suggest some edits to the docs for this today. 🙂

---

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/felicianotech/32/21348_2.png) [@FelicianoTech](https://discuss.circleci.com/u/FelicianoTech)\
**Post date:** [December 11, 2018, 12:07pm UTC](https://discuss.circleci.com/t/circleci-postgres-image-suddenly-causing-problems-role-postgres-not-found/25044/6 "2018-12-11T12:07:40Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
