Database Access from outside of the docker container

Dear Vikunja Community,

since we need to get a value returned via API for our activities, we need access from the localhost (server on which the docker is running) to the Vikunja database.

We have written the API and with test data it also returns corresponding values that are as we want them to be.

But if we now replace the test data with the database connection and query, we don’t get database access. Do we have to pay special attention to docker with the docker network?
When we are in the docker shell we can retrieve everything.

root@Vuptrox:~# docker exec -it vikunja-db-1 bash
root@a9c2521e9006:/# psql -U vikunja -d vikunja
^C
root@a9c2521e9006:/# \dt
^C
root@a9c2521e9006:/# psql -U vikunja -d vikunja
/dt
psql (16.4 (Debian 16.4-1.pgdg120+1))
Type "help" for help.

vikunja=# ^C
vikunja=# \dt
              List of relations
 Schema |       Name       | Type  |  Owner
--------+------------------+-------+---------
 public | api_tokens       | table | vikunja
 public | buckets          | table | vikunja
 public | favorites        | table | vikunja
 public | files            | table | vikunja
 public | label_tasks      | table | vikunja
 public | labels           | table | vikunja
 public | link_shares      | table | vikunja
 public | migration        | table | vikunja
 public | migration_status | table | vikunja
 public | notifications    | table | vikunja
 public | project_views    | table | vikunja
 public | projects         | table | vikunja
 public | reactions        | table | vikunja
 public | saved_filters    | table | vikunja
 public | subscriptions    | table | vikunja
 public | task_assignees   | table | vikunja
 public | task_attachments | table | vikunja
 public | task_buckets     | table | vikunja
 public | task_comments    | table | vikunja
 public | task_positions   | table | vikunja
 public | task_relations   | table | vikunja
 public | task_reminders   | table | vikunja
 public | tasks            | table | vikunja
 public | team_members     | table | vikunja
 public | team_projects    | table | vikunja
 public | teams            | table | vikunja
 public | totp             | table | vikunja
 public | typesense_sync   | table | vikunja
 public | unsplash_photos  | table | vikunja
 public | user_tokens      | table | vikunja
 public | users            | table | vikunja
 public | users_projects   | table | vikunja
 public | webhooks         | table | vikunja
(33 rows)

However, if we try to access the database from the localhost root, this does not work. Does anyone here have any tips or advice on how we can solve this or what we are overlooking here?

My bad… i forget to change the ports in the composer file for the database to access them from outside… its to late i guess.

With setting the ports its working completly fine!

No help needed anymore. Thank u!