Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FATAL: role "root" does not exist #4

Closed
kawaii opened this issue Nov 3, 2017 · 4 comments
Closed

FATAL: role "root" does not exist #4

kawaii opened this issue Nov 3, 2017 · 4 comments

Comments

@kawaii
Copy link
Contributor

kawaii commented Nov 3, 2017

I notice the following error in my logs appearing every 5 minutes or so:

FATAL:  role "root" does not exist

Whilst not harmful, and whilst the healthcheck is indeed working as intended (a docker ps displays a (healthy) status) is there any way to suppress this message? I assume this happens because the official PostgreSQL Docker images do not have a USER postgres declaration at the end of their Dockerfiles?

@peter-evans
Copy link
Owner

I'm not aware of this issue so I'll investigate and let you know if I find anything.

@kawaii
Copy link
Contributor Author

kawaii commented Nov 6, 2017

Thanks Peter, for reference here is the PostgreSQL snippet from my docker-compose.yml file:

  postgres:
    image: postgres:10.0
    hostname: postgres
    container_name: postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready"]
      interval: 30s
      timeout: 30s
      retries: 3
    env_file:
      - prosody.env
    volumes:
      - ${PWD}/postgres/data/:/var/lib/postgresql/data/
    restart: always

@peter-evans
Copy link
Owner

I haven't confirmed it, but I think this comment could be the explanation. As you mentioned, if the PostgreSQL Docker image had a USER postgres declaration then on repeated restarts of the container it would use the correct user.

According to the linked issue it can be prevented by deleting the volume with docker-compose down -v and forcing it to recreate the database each time. However, if you need to preserve the state I'm not really sure what the best solution is. You could make your own PostgreSQL Docker image and add in the USER postgres declaration, I suppose.

@bakasmarius
Copy link

@kawaii I spent half of yesterday trying to find out the cause of the FATAL: role "root" does not exist issue.
It turns out you need to specify the username you actually use to connect to your database (let's use "admin" for example:

   test: ["CMD-SHELL", "pg_isready -U admin"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants