Connecting to a Local PostgreSQL Container
pgAdmin 4 is a popular open-source tool for managing PostgreSQL databases. It provides a graphical interface that makes it easier to interact with PostgreSQL databases compared to using the command line. In this guide, we'll walk through the steps to connect pgAdmin 4 to a PostgreSQL database running in a local Docker container.
Step 1: Run Docker Compose
Make sure your containers are up and running.
npm run docker:compose
Step 2: Open pgAdmin 4
Open your pgAdmin 4 desktop app.
Step 3: Register a New Server
Right click on the Servers
-> Register -> Server...
Step 4: General Tab
- Name: postgres-db (
DB_SERVICE_NAME
from.env
)
Step 5: Connection Tab
-
Host name/address: localhost
-
Port: 5432 (
DB_PORT
from.env
) -
Maintenance database: launchgoatDev (
DB_NAME
from.env
) -
Username: launchgoatDevAdmin (
DB_USERNAME
from.env
) -
Password: hello (
DB_PASSWORD
from.env
)
Step 6: Check postgres-db
is Created
Access launchgoatDev
database.
Step 7: Open Query Tool
Right click on the Tables
-> Query Tool
Step 8: Check Seeded Data
Type and run
SELECT * FROM "User";