How to utilize dockerized postgres server outside of the container

Viewed 14

How do I do things like pg_dump and psql outside of the dockerized postgres server?

  1. Pull and run the latest postgres image
docker run --name postgresqldb -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e  POSTGRES_HOST_AUTH_METHOD=password -p 5432:5432 -d postgres
  1. Attempt to use psql
āžœ git:(development) āœ— psql
zsh: command not found: psql

What I'm trying to do is start up a postgres server container and utilize that container to run database exports (pg_dump) directly out of my terminal, not through use of the container with docker exec Though my terminal doesn't know what psql is. Is there a way I can hit this container through the port mappings? How would I do that?

0 Answers
Related