Writing into main nocobase postgresql database from externally

I have installed nocobase via docker image and it works fine. When installing it, I’ve selected postgresql as the underlying database of nocobase.
image

Now I’d like to write data into the main postgresql that is underlying nocobase via processes which are external to nocobase and I’m struggling to get this to work. I can’t log into that database via psql, although using the same login credential as in the docker-compose.yml that was used to install nocobase.

psql -d nocobase --username=nocobase --password
psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: FATAL: Peer authentication failed for user “nocobase”

postgresql tools such as pg admin also can’t find the database, showing no live servers.

How can I connect to the nocobase main postgresql database with external tools? For the avoidance of doubt, I am NOT looking to connect to an external postgresql database.

Thank you.

  1. Please refer to the following: Connecting to Postgresql in a docker container from outside - Stack Overflow.
  2. please ask AI .

Thank you, that worked.

Specifically, what I’ve done:

  1. Added these lines to docker-compose.yml:
    ports:

    • “5432:5432”
  2. These commands:
    docker-compose down
    sudo lsof -i :5432
    sudo systemctl stop postgresql
    sudo lsof -i :5432
    docker-compose up –d

Can then connect via psql.

1 Like