Connect to PostgreSQL in Docker from Mac
TableAI reaches a local PostgreSQL container through the port Docker publishes on your Mac. Use the host port, which can differ from the port inside the container.
Before you start
Section titled “Before you start”You need a running PostgreSQL container with a published TCP port and an initialized database. Use the database name, user, and password for the data stored in that container.
Find your connection details
Section titled “Find your connection details”Run this in Terminal:
docker psFind the PostgreSQL container’s port mapping.
For example, 127.0.0.1:5433->5432/tcp maps your Mac’s port 5433 to PostgreSQL’s port 5432.
See Docker port publishing for configuration details.
| TableAI field | Value for this example |
|---|---|
| Host | 127.0.0.1 |
| Port | 5433 |
| Database, User, Password | Credentials for the initialized database |
Connect to PostgreSQL in Docker from Mac
Section titled “Connect to PostgreSQL in Docker from Mac”- Start a PostgreSQL connection using connection basics.
- Enter the host and published port from the mapping above.
- Enter the database credentials.
- Click Test.
- Click Save & Connect after a successful test.
SSL and remote containers
Section titled “SSL and remote containers”Configure SSL for the PostgreSQL server inside the container; see SSL/TLS. If Docker runs on another machine, use that machine’s reachable address or an SSH tunnel.
If it does not connect
Section titled “If it does not connect”connection refusedpassword authentication failed for userFor a refusal, confirm that docker ps shows both a running container and a published port.
Check the container log for startup errors if PostgreSQL is not ready.
For a password error, verify the credentials of the existing database.
Changing initialization environment variables does not reset accounts in an existing data volume.
Preserve the database volume before changing the container. Deleting it can delete the database. See the PostgreSQL image’s initialization rules.
Use 28P01 for authentication checks and connection failed for other failures.
Related
Section titled “Related”- Local PostgreSQL for TCP readiness checks.
- Browse and search after connecting.
- PostgreSQL overview.
- PostgreSQL client for Mac for an overview of TableAI with Postgres.