Development version with docker : error connection refused on database / getaddrinfo EAI_AGAIN #159

Open
opened 2026-02-04 17:34:22 +03:00 by OVERLORD · 9 comments
Owner

Originally created by @0x0fe on GitHub (Jan 18, 2022).

image

I installed docker desktop, and created a new dev environement, which pulled planka github fork. docker-compose -f docker-compose-dev.yml up runs fine, but npm run server:db:init fails because it cannot reach the database. I have tried changing the URL to the one provided by the let terminal, with the same result, connection refused.

Originally created by @0x0fe on GitHub (Jan 18, 2022). ![image](https://user-images.githubusercontent.com/89607149/149959046-98b2b046-54bd-4e7c-a940-efa4cf49c0f2.png) I installed docker desktop, and created a new dev environement, which pulled planka github fork. docker-compose -f docker-compose-dev.yml up runs fine, but npm run server:db:init fails because it cannot reach the database. I have tried changing the URL to the one provided by the let terminal, with the same result, connection refused.
Author
Owner

@0x0fe commented on GitHub (Jan 18, 2022):

OK, i found the problem:

DATABASE_URL=postgresql://postgres@elated_elion:5432/planka

the base url has to use the docker container name instead of localhost

image

@0x0fe commented on GitHub (Jan 18, 2022): OK, i found the problem: DATABASE_URL=postgresql://postgres@elated_elion:5432/planka the base url has to use the docker container name instead of localhost ![image](https://user-images.githubusercontent.com/89607149/149962851-38571fa1-57f3-4670-b9b0-4150f602e2cb.png)
Author
Owner

@0x0fe commented on GitHub (Jan 18, 2022):

well, actually there is another error now

getaddrinfo EAI_AGAIN

@0x0fe commented on GitHub (Jan 18, 2022): well, actually there is another error now getaddrinfo EAI_AGAIN
Author
Owner

@0x0fe commented on GitHub (Jan 18, 2022):

So it looks like there is still problems with reaching the database

[server]` [nodemon] 2.0.12
[server] [nodemon] to restart at any time, enter `rs`
[server] [nodemon] watching path(s): *.*
[server] [nodemon] watching extensions: js,mjs,json
[server] [nodemon] starting `node app.js`
[server]  info: Initializing custom hook (`current-user`)
[server] error: Ignoring attempt to bind route (`/*`) to unknown view: `index`
[server]  info: 
[server]  info:                .-..-.
[server]  info: 
[server]  info:    Sails              <|    .-..-.
[server]  info:    v1.4.4              |\
[server]  info:                       /|.\
[server]  info:                      / || \
[server]  info:                    ,'  |'  \
[server]  info:                 .-'.-==|/_--'
[server]  info:                 `--'-------' 
[server]  info:    __---___--___---___--___---___--___
[server]  info:  ____---___--___---___--___---___--___-__
[server]  info: 
[server]  info: Server lifted in `/com.docker.devenvironments.code/server`
[server]  info: To shut down Sails, press <CTRL> + C at any time.
[server]  info: Read more at https://sailsjs.com/support.
[server] 
[server] debug: -------------------------------------------------------
[server] debug: :: Tue Jan 18 2022 16:27:14 GMT+0000 (Coordinated Universal Time)
[server] debug: Environment : development
[server] 
[server] debug: Port        : 1337
[server] debug: -------------------------------------------------------
[client] ℹ 「wds」: Project is running at http://172.17.0.2/
[client] ℹ 「wds」: webpack output is served from 
[client] ℹ 「wds」: Content not from webpack is served from /com.docker.devenvironments.code/client/public
[client] ℹ 「wds」: 404s will fallback to /
[client] Starting the development server...
[client] 
[client] Browserslist: caniuse-lite is outdated. Please run:
[client] npx browserslist@latest --update-db
[client] 
[client] Why you should do it regularly:
[client] https://github.com/browserslist/browserslist#browsers-data-updating
[client] Compiled successfully!
[client] 
[client] You can now view planka-client in the browser.
[client] 
[client]   Local:            http://localhost:3000
[client]   On Your Network:  http://172.17.0.2:3000
[client] 
[client] Note that the development build is not optimized.
[client] To create a production build, use npm run build.
[client] 
[server] Troubleshooting tips:
[server] 
[server]  -> Is your Postgresql configuration correct?  Maybe your `poolSize` configuration is set too high? e.g. If your Postgresql database only supports 20 concurrent connections, you should make sure you have your `poolSize` set as something < 20 (see http://stackoverflow.com/a/27387928/486547). The default `poolSize` is 10. To override default settings, specify the desired properties on the relevant Postgresql "connection" config object where the host/port/database/etc. are configured. If you're using Sails, this is generally located in `config/datastores.js`, or wherever your environment-specific database configuration is set.
[server] 
[server]  -> Maybe your `poolSize` configuration is set too high? e.g. If your Postgresql database only supports 20 concurrent connections, you should make sure you have your `poolSize` set as something < 20 (see http://stackoverflow.com/a/27387928/486547). The default `poolSize` is 10.
[server] 
[server]  -> Do you have multiple Sails instances sharing the same Postgresql database? Each Sails instance may use up to the configured `poolSize` # of connections. Assuming all of the Sails instances are just copies of one another (a reasonable best practice) we can calculate the actual # of Postgresql connections used (C) by multiplying the configured `poolSize` (P) by the number of Sails instances (N). If the actual number of connections (C) exceeds the total # of **AVAILABLE** connections to your Postgresql database (V), then you have problems.  If this applies to you, try reducing your `poolSize` configuration. A reasonable `poolSize` setting would be V/N.
[server] 
[server]  -> Are you using an SSL-enabled Postgresql host like Heroku? Make sure to set `ssl` to `true` (see http://stackoverflow.com/a/22177218/486547)
[server] 
[server] 
[server] error: Sending 500 ("Server Error") response: 
[server]  AdapterError: Unexpected error from database adapter: `select` failed ("badConnection").  A connection either could not be obtained or there was an error using the connection.
[server] Additional data:
[server] 
[server] {
[server]   error: Error: getaddrinfo EAI_AGAIN silly_pare
[server]       at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
[server]     errno: -3001,
[server]     code: 'EAI_AGAIN',
[server]     syscall: 'getaddrinfo',
[server]     hostname: 'silly_pare'
[server]   },
[server]   meta: {
[server]     adapter: 'sails-postgresql-redacted',
[server]     url: 'postgresql://postgres@silly_pare/planka',
[server]     identity: 'default'
[server]   }
[server] }
[server]     at fn (/com.docker.devenvironments.code/server/api/helpers/users/get-one.js:27:17)
[server]     at wrapper (/com.docker.devenvironments.code/server/node_modules/@sailshq/lodash/lib/index.js:3282:19)
[server]     at Deferred.parley.retry [as _handleExec] (/com.docker.devenvironments.code/server/node_modules/machine/lib/private/help-build-machine.js:1014:29)
[server]     at Deferred.exec (/com.docker.devenvironments.code/server/node_modules/parley/lib/private/Deferred.js:286:10)
[server]     at Deferred.tryCatcher (/com.docker.devenvironments.code/server/node_modules/bluebird/js/release/util.js:11:23)
[server]     at ret (eval at makeNodePromisifiedEval (/com.docker.devenvironments.code/server/node_modules/bluebird/js/release/promisify.js:184:12), <anonymous>:14:23)
[server]     at Deferred.toPromise (/com.docker.devenvironments.code/server/node_modules/parley/lib/private/Deferred.js:572:19)
[server]     at Deferred.then (/com.docker.devenvironments.code/server/node_modules/parley/lib/private/Deferred.js:431:22)
[server]     at processTicksAndRejections (node:internal/process/task_queues:96:5)`

Steps to reproduce the issue:

-create a new dev environement in docker pulling planka from github
-open the container in the dev environement window and clic the "open in vscode" button
-in vscode open a terminal and run docker-compose -f docker-compose-dev.yml up
-open another terminal and run npm run server:db:init
-open a third terminal and run npm start
-open http://localhost:3000/ or http://localhost:1337

The second terminal will show the error (also reported in the 3rd terminal).

@0x0fe commented on GitHub (Jan 18, 2022): So it looks like there is still problems with reaching the database ``` [server]` [nodemon] 2.0.12 [server] [nodemon] to restart at any time, enter `rs` [server] [nodemon] watching path(s): *.* [server] [nodemon] watching extensions: js,mjs,json [server] [nodemon] starting `node app.js` [server] info: Initializing custom hook (`current-user`) [server] error: Ignoring attempt to bind route (`/*`) to unknown view: `index` [server] info: [server] info: .-..-. [server] info: [server] info: Sails <| .-..-. [server] info: v1.4.4 |\ [server] info: /|.\ [server] info: / || \ [server] info: ,' |' \ [server] info: .-'.-==|/_--' [server] info: `--'-------' [server] info: __---___--___---___--___---___--___ [server] info: ____---___--___---___--___---___--___-__ [server] info: [server] info: Server lifted in `/com.docker.devenvironments.code/server` [server] info: To shut down Sails, press <CTRL> + C at any time. [server] info: Read more at https://sailsjs.com/support. [server] [server] debug: ------------------------------------------------------- [server] debug: :: Tue Jan 18 2022 16:27:14 GMT+0000 (Coordinated Universal Time) [server] debug: Environment : development [server] [server] debug: Port : 1337 [server] debug: ------------------------------------------------------- [client] ℹ 「wds」: Project is running at http://172.17.0.2/ [client] ℹ 「wds」: webpack output is served from [client] ℹ 「wds」: Content not from webpack is served from /com.docker.devenvironments.code/client/public [client] ℹ 「wds」: 404s will fallback to / [client] Starting the development server... [client] [client] Browserslist: caniuse-lite is outdated. Please run: [client] npx browserslist@latest --update-db [client] [client] Why you should do it regularly: [client] https://github.com/browserslist/browserslist#browsers-data-updating [client] Compiled successfully! [client] [client] You can now view planka-client in the browser. [client] [client] Local: http://localhost:3000 [client] On Your Network: http://172.17.0.2:3000 [client] [client] Note that the development build is not optimized. [client] To create a production build, use npm run build. [client] [server] Troubleshooting tips: [server] [server] -> Is your Postgresql configuration correct? Maybe your `poolSize` configuration is set too high? e.g. If your Postgresql database only supports 20 concurrent connections, you should make sure you have your `poolSize` set as something < 20 (see http://stackoverflow.com/a/27387928/486547). The default `poolSize` is 10. To override default settings, specify the desired properties on the relevant Postgresql "connection" config object where the host/port/database/etc. are configured. If you're using Sails, this is generally located in `config/datastores.js`, or wherever your environment-specific database configuration is set. [server] [server] -> Maybe your `poolSize` configuration is set too high? e.g. If your Postgresql database only supports 20 concurrent connections, you should make sure you have your `poolSize` set as something < 20 (see http://stackoverflow.com/a/27387928/486547). The default `poolSize` is 10. [server] [server] -> Do you have multiple Sails instances sharing the same Postgresql database? Each Sails instance may use up to the configured `poolSize` # of connections. Assuming all of the Sails instances are just copies of one another (a reasonable best practice) we can calculate the actual # of Postgresql connections used (C) by multiplying the configured `poolSize` (P) by the number of Sails instances (N). If the actual number of connections (C) exceeds the total # of **AVAILABLE** connections to your Postgresql database (V), then you have problems. If this applies to you, try reducing your `poolSize` configuration. A reasonable `poolSize` setting would be V/N. [server] [server] -> Are you using an SSL-enabled Postgresql host like Heroku? Make sure to set `ssl` to `true` (see http://stackoverflow.com/a/22177218/486547) [server] [server] [server] error: Sending 500 ("Server Error") response: [server] AdapterError: Unexpected error from database adapter: `select` failed ("badConnection"). A connection either could not be obtained or there was an error using the connection. [server] Additional data: [server] [server] { [server] error: Error: getaddrinfo EAI_AGAIN silly_pare [server] at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) { [server] errno: -3001, [server] code: 'EAI_AGAIN', [server] syscall: 'getaddrinfo', [server] hostname: 'silly_pare' [server] }, [server] meta: { [server] adapter: 'sails-postgresql-redacted', [server] url: 'postgresql://postgres@silly_pare/planka', [server] identity: 'default' [server] } [server] } [server] at fn (/com.docker.devenvironments.code/server/api/helpers/users/get-one.js:27:17) [server] at wrapper (/com.docker.devenvironments.code/server/node_modules/@sailshq/lodash/lib/index.js:3282:19) [server] at Deferred.parley.retry [as _handleExec] (/com.docker.devenvironments.code/server/node_modules/machine/lib/private/help-build-machine.js:1014:29) [server] at Deferred.exec (/com.docker.devenvironments.code/server/node_modules/parley/lib/private/Deferred.js:286:10) [server] at Deferred.tryCatcher (/com.docker.devenvironments.code/server/node_modules/bluebird/js/release/util.js:11:23) [server] at ret (eval at makeNodePromisifiedEval (/com.docker.devenvironments.code/server/node_modules/bluebird/js/release/promisify.js:184:12), <anonymous>:14:23) [server] at Deferred.toPromise (/com.docker.devenvironments.code/server/node_modules/parley/lib/private/Deferred.js:572:19) [server] at Deferred.then (/com.docker.devenvironments.code/server/node_modules/parley/lib/private/Deferred.js:431:22) [server] at processTicksAndRejections (node:internal/process/task_queues:96:5)` ``` Steps to reproduce the issue: -create a new dev environement in docker pulling planka from github -open the container in the dev environement window and clic the "open in vscode" button -in vscode open a terminal and run docker-compose -f docker-compose-dev.yml up -open another terminal and run npm run server:db:init -open a third terminal and run npm start -open http://localhost:3000/ or http://localhost:1337 The second terminal will show the error (also reported in the 3rd terminal).
Author
Owner

@mattague commented on GitHub (Oct 20, 2023):

Has there been any update on this? I have been unable to get Planka started, and it seems to just be unable to connect to the database.

@mattague commented on GitHub (Oct 20, 2023): Has there been any update on this? I have been unable to get Planka started, and it seems to just be unable to connect to the database.
Author
Owner

@daniel-hiller commented on GitHub (Oct 20, 2023):

An update on what?
You are posting into an 2year old issue

@daniel-hiller commented on GitHub (Oct 20, 2023): An update on what? You are posting into an 2year old issue
Author
Owner

@mattague commented on GitHub (Oct 20, 2023):

An open two year old issue, with someone else experiencing the same unresolved issue 9 months ago, and no activity or advice since then.

I am just asking, on this open issue, if the original user, or anyone else who might have run into this issue, figured out what was causing it and possibly figured out how to resolve it. I would like to selfhost this project, but the docker-compose file provided seems to hang up.

@mattague commented on GitHub (Oct 20, 2023): An _**open**_ two year old issue, with someone else experiencing the same unresolved issue 9 months ago, and no activity or advice since then. I am just asking, on this _open_ issue, if the original user, or anyone else who might have run into this issue, figured out what was causing it and possibly figured out how to resolve it. I would like to selfhost this project, but the docker-compose file provided seems to hang up.
Author
Owner

@meltyshev commented on GitHub (Oct 20, 2023):

Hi! Are you trying to install using docker-compose.yml or just to develop with docker-compose-dev.yml?
If there is any problem with the installation, please let us know all your steps and what error you are getting, that way it'll be easier to figure out.

@meltyshev commented on GitHub (Oct 20, 2023): Hi! Are you trying to install using `docker-compose.yml` or just to develop with `docker-compose-dev.yml`? If there is any problem with the installation, please let us know all your steps and what error you are getting, that way it'll be easier to figure out.
Author
Owner

@0x0fe commented on GitHub (Oct 20, 2023):

@mattague honnestly i dont recall, its pretty old, in the end we could run this planka on the hosting.

@0x0fe commented on GitHub (Oct 20, 2023): @mattague honnestly i dont recall, its pretty old, in the end we could run this planka on the hosting.
Author
Owner

@sunchezz89 commented on GitHub (Apr 24, 2025):

I get a similar/same issue.
I just tried to follow the docker-compose instructions, did not change anything (except what was mentioned in the Docs).

I tried to disable IP6, I tried to create explicit docker network, I tried using "localhost" for DATABASE_URL, I tried to use the resolved IP (seen in the logs).
All attempts lead to planka not starting.

Help is appreciated, as this is not even a special case. And the fix could be mentioned in the docs as hint as well.

planka_1    | node:internal/process/promises:288
planka_1    |             triggerUncaughtException(err, true /* fromPromise */);
planka_1    |             ^
planka_1    |
planka_1    | Error: connect EHOSTUNREACH 172.24.0.2:5432
planka_1    |     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
planka_1    |   errno: -113,
planka_1    |   code: 'EHOSTUNREACH',
planka_1    |   syscall: 'connect',
planka_1    |   address: '172.24.0.2',
planka_1    |   port: 5432
planka_1    | }
planka_1    |
planka_1    | Node.js v18.20.8
planka_planka_1 exited with code 1
version: '3'

services:
  planka:
    image: ghcr.io/plankanban/planka:latest
    restart: on-failure
    volumes:
      - user-avatars:/app/public/user-avatars
      - project-background-images:/app/public/project-background-images
      - attachments:/app/private/attachments
    ports:
      - 3000:1337
    environment:
      - BASE_URL=http://my-example-base-url.de:3000
      - DATABASE_URL=postgresql://postgres@postgres/planka
# truncated file content - irrelevant

  postgres:
    image: postgres:alpine
    restart: on-failure
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=planka
      - POSTGRES_HOST_AUTH_METHOD=trust
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d planka"]
      interval: 10s
      timeout: 10s
      retries: 5

volumes:
  user-avatars:
  project-background-images:
  attachments:
  db-data:
@sunchezz89 commented on GitHub (Apr 24, 2025): I get a similar/same issue. I just tried to follow the docker-compose instructions, did not change anything (except what was mentioned in the Docs). I tried to disable IP6, I tried to create explicit docker network, I tried using "localhost" for DATABASE_URL, I tried to use the resolved IP (seen in the logs). All attempts lead to planka not starting. Help is appreciated, as this is not even a special case. And the fix could be mentioned in the docs as hint as well. ``` planka_1 | node:internal/process/promises:288 planka_1 | triggerUncaughtException(err, true /* fromPromise */); planka_1 | ^ planka_1 | planka_1 | Error: connect EHOSTUNREACH 172.24.0.2:5432 planka_1 | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) { planka_1 | errno: -113, planka_1 | code: 'EHOSTUNREACH', planka_1 | syscall: 'connect', planka_1 | address: '172.24.0.2', planka_1 | port: 5432 planka_1 | } planka_1 | planka_1 | Node.js v18.20.8 planka_planka_1 exited with code 1 ``` ``` version: '3' services: planka: image: ghcr.io/plankanban/planka:latest restart: on-failure volumes: - user-avatars:/app/public/user-avatars - project-background-images:/app/public/project-background-images - attachments:/app/private/attachments ports: - 3000:1337 environment: - BASE_URL=http://my-example-base-url.de:3000 - DATABASE_URL=postgresql://postgres@postgres/planka # truncated file content - irrelevant postgres: image: postgres:alpine restart: on-failure volumes: - db-data:/var/lib/postgresql/data environment: - POSTGRES_DB=planka - POSTGRES_HOST_AUTH_METHOD=trust healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d planka"] interval: 10s timeout: 10s retries: 5 volumes: user-avatars: project-background-images: attachments: db-data: ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#159