Connect to PostgreSQL / Docker

I have a very interesting issue which might be interesting to other developers who love AdonisJS.

I run AdonisJS and PG in docker in two containers:

CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                                            NAMES
2c30b1f66607        syndicate_app          "npm start"              9 minutes ago       Up 4 minutes>3333/tcp,>9229/tcp   syndicate_js
8f0224c55320        postgres:11.3-alpine   "docker-entrypoint.s…"   9 minutes ago       Up 4 minutes>5432/tcp                          syndicate_db

From local console when I can connect to PG database without any errors:

$ adonis migration:run
Nothing to migrate

When I open website in the browser I have an error:


I think the problem is that the current host of AdonisJS container is the same as PG -

Who can help to solve this issue?


Hi @glodov

I am using quite same setup and everything works fine.
Only difference seems to be, that I expose port 5432 for PG

Can you share your DB host and port in .env and config/database.js?

Also, after doing changes in .env files you have to manually restart Adonis API for it to take effect. Since --dev mode does not autorestart on .env changes.