DEV Community

Jakub Rumpel
Jakub Rumpel

Posted on • Updated on

Quick-start SQL Server 2019 in Docker

It's not any kind of magic, but every time I have to do it, I find myself googling for the exact command again and again, So I decided to just save it here - for me, later, and for anyone else who want to paste a command into the terminal and be done with it.

I assume that you already have Docker installed, but in case you don't, there is a great tutorial for Windows here, or for Ubuntu here on how to do it.

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<YourStrong@Passw0rd>" \
   -p 1433:1433 --name YourContainerName -h ContainerHostname \
   -d mcr.microsoft.com/mssql/server:2019-latest
Enter fullscreen mode Exit fullscreen mode

If you need any additional information, check out this page for details about arguments and passed values.

REMEMBER: Password has to be compliant with SQL Server default password policy:

By default, the password must be at least 8 characters long and contain characters from three of the following four sets: Uppercase letters, Lowercase letters, Base 10 digits, and Symbols

To check if your container works properly, see it's status using this command:

docker ps
Enter fullscreen mode Exit fullscreen mode

If you can't see it, run it with "-a" argument to see if it's shut down.

docker ps -a
Enter fullscreen mode Exit fullscreen mode

If you have any trouble starting the image, you can see container log by running this command:

docker logs YourContainerName 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)