Run MSSQL on Docker for Windows
For some time now, Microsoft has been providing various MSSQL Server versions for Docker - for Linux and for Windows. This means that spending a few hours to install MSSQL Server on your own PC is a thing of the past and is now available with Docker in a few moments.
Docker for Windows
Docker for Windows is an application by Docker in cooperation with Microsoft to be able to use Docker Containers on a PC for software development. This is possible with Hyper-V and in newer Windows versions with WSL.
This single command makes the sorcery:
docker run --name mssql -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=TestPass123#" -p 31000:1433 -d mcr.microsoft.com/mssql/server:2017-latest-ubuntu
This command causes:
- downloads the Docker Image MSSQL 2017 on Ubuntu.
- accepts the EULA.
- sets the default password of the admin user "SA" to "TestPass123#".
- sets the local port 31000 for this Docker container.
- give the Docker container the name "mssql"
If the command executes successfully, the Docker container is running. You can stop the Container with
docker stop mssql and start it again with
docker start mssql
To list all your container - to check if the container is running or not - you can use
docker ps -a
Microsoft MSSQL on DockerHub
DockerHub is the central place for Docker Images.
The official Docker Hub page for the MSSQL Server (managed by Microsoft) is: https://hub.docker.com/_/microsoft-mssql-server