# Check Postgres db table in Docker

> Open a PostgreSQL shell inside a Docker container, list tables, inspect a schema, and query its rows.

- Canonical: https://preview.arshadmehmood.com/today-i-learned/docker/check-postgres-db-table-in-docker/
- Section: docker
- Author: Arshad Mehmood

```bash
# List running containers to find the container ID or name
docker ps

# Access the PostgreSQL container
docker exec -it postgres_container bash

# Connect to PostgreSQL
psql -U postgres -d mydatabase

# List all tables
\dt

# Describe the structure of the 'ratings' table
\d ratings

# Query data from the 'ratings' table
SELECT * FROM ratings;
```

