How to ping the address for postgres?

Viewed 1808

I am trying to set up postgres with docker. I want to verify the address for my database, thus I tried ping 0.0.0.0:5432 and ping 127.0.0.1:5432 and ping localhost:5432, but all returned Unknown host and cannot be resolved.

Why is that? what is the correct address for postgres? My psql is running correctly.

1 Answers

It is not clear from the question, but if the database is running in the docker container, make sure you exposed the 5432 port to the host machine. Use --expose if you are starting container with docker run ... (doc) or add

ports:
      - "5432:5432"

to your docker-compose file (doc)

Related