Problem connecting to postgresql instance

I am going through the couch2pg setup tutorial. I am using postgresql version 13 and I keep getting the error:
“psql: error: could not translate host name “postgres” to address: Name or
service not known”
When I try connecting to the postgresql instance with the command:
“psql postgres://cht_couch2pg:cht_couch2pg_password@postgres:5432/cht”
I am using UBUNTU 22.04 terminal on windows
Could someone help

Hi @samson

Can you please link which tutorial you are following?
This looks like a setup error, where the postgres is not available through the way your network is setup.

Thanks!

Thanks for replying Diana, the link to the tutorial I am following is: Local Couch2pg Setup | Community Health Toolkit

I’m checking the instructions for setting up the environment:

Can you please confirm the value you used for POSTGRESQL_URL ?

Sure, I used:
postgres://cht_couch2pg:cht_couch2pg_password@postgres:5432/cht

But for the export variable, I used:
POSTGRESQL_URL=postgres://couch2pg:mypassword@localhost:5432/postgres_db_name

I have done a bit of debugging and isolated the error from docker:
Database is uninitialized and superuser password is not specified.
You must specify POSTGRES_PASSWORD to a non-empty value for the
superuser. For example, “-e POSTGRES_PASSWORD=password” on “docker run”.

1 Like