Skip to content

Connect to pg database and delete some stuff from the shell #4088

Discussion options

You must be logged in to vote

Assuming the postgres container is alreasdy running, you can open a bash shell prompt with:

docker-compose -f local.yml exec postgres bash

From there, you can type psql to run a SQL REPL and execute whatever queries you need. Make sure to connect with the right credentials, they are located in .envs/.local/.postgres, which should be in the container environment:

psql -d ${POSTGRES_DB} -U ${POSTGRES_USER}

If you want to connect with a more visual tool from outside the container, you'll need to map the Postgres port (5432) to your host machine. This is usually done by adding them to the docker compose config file local.yml:

   postgres:
+    ports:
+      - "5432:5432"
     build:

More ex…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nelsonmandeladev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants