Error :

postgres port 5432 failed: could not open certificate file “/root/.postgresql/postgresql.crt”: Permission denied

Problem Statement:

When working with Postgres Database

Verified Solution:

If you’ve encountered this error, a possible solution lies in a workaround shared by the community. A thread on GitHub (Link) discusses the problem, and a workaround is suggested in another thread (Link).

For Dockerfile users, the suggested solution involves adding the following line to your Dockerfile:

ENV PGSSLCERT /tmp/postgresql.crt

Reference:

  1. GitHub Thread – psycopg/psycopg2
  2. GitHub Thread – nginx/unit
  3. Stack Overflow – Django psycopg2 OperationalError

By following this workaround, you can potentially resolve the permission denied issue related to the postgresql.crt file and ensure a smooth Postgres Database connection on port 5432.