Reputation: 37
I have a CentOS 7 server, on which individually postgres (port 5432) and docker is running.
Currently I am trying to access postgres database from my docker container. But I am getting the below error:
at Connection.parseE (/usr/app/node_modules/pg/lib/connection.js:604:11)
at Connection.parseMessage (/usr/app/node_modules/pg/lib/connection.js:401:19)
at Socket.<anonymous> (/usr/app/node_modules/pg/lib/connection.js:121:22)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 161,
severity: 'FATAL',
code: '28000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '489',
routine: 'ClientAuthentication' }```
I have change pg_hba.conf of my host postgres application that too didn't solve the issue.
Any help will be appreciated.
Upvotes: 1
Views: 323
Reputation: 37
Thanks Clemans for your help, I got the solution. Issue was due to docker network since it was not able to connect to host. Since by default my container was running in docker network bridge. I changed that to run into host which solve my issue. Below is the command which I used to run my container
docker run --network=host -d <image name>
Upvotes: 2