SQL Server on Docker

To run a Microsoft SQL Server container image with Docker:

  1. Install and set up

  2. Run the following command in your terminal to download the Microsoft SQL Server 2019 image:

    $docker pull mcr.microsoft.com/mssql/server:2019-latest
  3. Create an instance of the container image, replacing the value of SA_PASSWORD with a password of your choice:

    $docker run --name sql_container -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=myPassword' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest
  4. , replacing the image name and password with your own.

  5. From the sqlcmd command prompt, create a new database:

    $CREATE DATABASE quickstart
  6. Run the following command to check that your database was created successfully:


Connection URL credentials

Based on this example, your credentials are:

  • Username: sa
  • Password: myPassword
  • Database: quickstart
  • Port: 1433