Skip to content

Connect to SQL Server in Docker from Mac

Connect to the Docker host and its published port. The port inside the container can differ from the port TableAI needs.

Have a running SQL Server container, a published database port and a SQL account with access to your database. This guide starts after container creation; Microsoft’s container quickstart covers that setup.

Run this on the Docker host:

Terminal window
docker ps

Read the PORTS column for the SQL Server container. For example:

127.0.0.1:1401->1433/tcp

This mapping exposes container port 1433 as host port 1401. For Docker on your Mac, TableAI uses Host 127.0.0.1 and Port 1401.

For Docker on another computer, use that host’s reachable address and published port. A mapping bound to 127.0.0.1 is accessible only from the Docker host.

Check the SQL Server error log for SQL Server is now ready for client connections. before connecting. See Microsoft’s container troubleshooting guide if the container exits or never becomes ready.

  1. Open a new connection and select SQL Server.
  2. Enter the Docker host as Host and the published host port as Port.
  3. Enter the Database, SQL User and Password for that container’s database.
  4. Configure the server certificate settings.
  5. Click Test.
  6. Click Save & Connect after a successful test.

Configure a trusted server certificate whose name matches Host. For a private CA, select that CA in the connection form. Publishing a container port does not configure its certificate.

For a remote Docker host reached through SSH, use the host address and published port as seen from the SSH server. Follow the SSH tunnel guide for the tunnel settings.

The SQL Server URL format also works here. Substitute the published host port.

  • Container absent from docker ps: use docker ps -a to check stopped containers, then inspect its startup error.
  • Connection refused: compare Port with the host side of the published mapping.
  • Login failed: follow error 18456. With a reused data volume, use the password stored in that database, which can differ from the container’s startup setting.
  • Certificate failure: check the container’s certificate and TLS repair.

For remote-host timeouts, use connection failed.

Return to the SQL Server overview or run your first query.