Skip to main content

Run SQL Server as Docker container

warning

This tutorial assumes you are on a Windows machine

Use Cases

  • You want a SQL Server instance running locally

Description

This tutorial shows you how to run SQL Server as a Docker container.

Prerequisites

  • Have docker installed on your machine
  • Have PowerShell installed
info

You can probably use differnt CLIs, but I haven't tested that.

Instructions

  1. Open PowerShell
  2. Run docker pull mcr.microsoft.com/mssql/server:2022-latest
  3. Run docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=yourserveradminpassword" --name your-sql-server-instance-name -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest
info

Replace yourserveradminpassword with a password you came up with. Replace your-sql-server-instance-name with the name you want for the SQL Server instance.

info

The username for the server will be "sa" by default