strapi / strapi-docker

Install and run your first Strapi project using Docker
https://strapi.io
MIT License
1.16k stars 447 forks source link

Error: getaddrinfo ENOTFOUND postgres #317

Closed priofy closed 2 years ago

priofy commented 2 years ago

I pushed the repo to github, when my new co-worker cloned it, he wasn't able to run it and running into errors. Is there any documentation or guides that could help with the development workflow with github and docker?

Here are the errors: 1- FATAL: could not open directory "pg_notify": No such file or directory

Then it continued to install the deps until it compiled the webpack successfully, then exited with code #1 with the following error:

2- error Error: getaddrinfo ENOTFOUND postgres strapi_1 | at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)

Your help is appreciated.

ChristianHeimke commented 2 years ago

it sounds like a broken dev-env config and more related to the docker(-compose) setup than to strapi itself.

did you follow the strapi docker-compose guide at https://strapi.io/blog/how-to-run-a-strapi-dev-stack-with-docker-compose ?

if you need more support please provide more information (or maybe invite me to the repo to see the configuration/docker setup).

priofy commented 2 years ago

Thank you @ChristianHeimke

I believe its the dev-env as well after going through the link. Will give it a shot and update you with the output.

priofy commented 2 years ago

I've followed the guide, by adding the .env file into the project and updating the .yml file. (This project was created and ran previously).

It gives an error: [FATAL: database files are incompatible with server The data directory was initialized by PostgresSQL version 13, which is not compatible with this version 14.0 (Debian 14.0-1.pgdg110+1).

I believe its a version error but how do we change the version of the directory at this point?

priofy commented 2 years ago

Hi @ChristianHeimke I have fixed the env situation but when I cloned it on another machine, it started giving a new error for the database: FATAL: could not open directory "pg_notify": No such file or directory

At the end, it exited with the following error. This error is due to the fact that the database container wasn't able to boot up, (which means if the "pg_notify" situation was resolved; the whole thing would be fixed): error Error: getaddrinfo ENOTFOUND postgres

Your input is highly appreciated

ChristianHeimke commented 2 years ago

for those who have a similar issue: the solution was to change the docker-compose network config from this:

networks:
  strapi-app-network:
    driver: bridge

to this:

networks:
  strapi-app-network: {}

for some reasons it works - even that the bridge type is the default of the networking.

DeividVeloso commented 2 years ago

it did not work form me, same issue here

priofy commented 2 years ago

Its a network error. I have gained a lot of experience with strapi, postgres and docker since I’ve opened this issue.

You’re welcome to add me to have a look at your strapi repo.