How to connect SQL Server from docker container using SSMS

less than 1 minute read

Sometimes we need to access database which is running in container. It’s simple but sometimes we cannot remember. Here, I will show you how to connect SQL Server from docker container using SQL Server Management Studio.

Sample docker-compose.yml

  sqldbsaga:
   image: mcr.microsoft.com/mssql/server:2019-latest 

docker-compose.override.yml

  sqldbsaga:
   environment:
    - SA_PASSWORD=MyPass@word
    - ACCEPT_EULA=Y
   ports:
    - "5533:1433"
   volumes:
    - kyc-saga-sqldb:/var/opt/mssql

Now connect using SSMS

  • Run docker compose file
  • Run SQL server management studio
  • Server name should be - localhos, port name
  • Password would be MyPass@word as below image

Then, click Connect.

Comments