← All posts

Docker Compose. Restoring Access to PostgreSQL

If PostgreSQL reports “role is not permitted to log in”, you can try re-enabling login for the role with this workaround:

postgres:
    image: postgres
    user: postgres
    command: >
      sh -c 'postgres --single << "ALTER ROLE <USERNAME> WITH LOGIN"'

Then start the service:

docker-compose up -d postgres

This enables the database role to log in again.

Comments are closed. Read the original discussion in Russian →