Skip to content

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.

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.

Run this in Terminal:

Terminal window
docker ps

Find 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
  1. Start a PostgreSQL connection using connection basics.
  2. Enter the host and published port from the mapping above.
  3. Enter the database credentials.
  4. Click Test.
  5. Click Save & Connect after a successful test.

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.

connection refused
password authentication failed for user

For 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.