SQL Server on Linux
Since the release candidate (RC) of SQL Server 2017 came out, it appeared that Microsoft’s database platform supported not only the Windows operating system, but also Linux and Docker containers. With this, Microsoft has broken new ground, which turns out to be very interesting for me. The ability to run SQL Server on Linux or in a Docker container brings all sorts of interesting possibilities. In this blog, I zoom in on running SQL Server in a Docker container.
Docker
Microsoft has made it very easy to start running SQL Server in Docker yourself. A number of official images have been made available on the Docker Hub (Microsoft on Docker Hub). All you have to do is start a container and point to an image from Microsoft and you have a SQL Server running.
How do you run SQL Server in Docker?
To actually run SQL Server on a Docker image, the following are required:
- A working Docker environment (see part 1 of Craig’s blog)
- A working internet connection (for bringing in the images)
Start
To start a new Docker image containing Microsoft SQL Server, use the following command:
docker run --name some-mssql -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=VeryStrongPassword@2019' -d mcr.microsoft.com/mssql/server:2017-latest-ubuntu
When Docker has completely finished fetching the image, it launches and returns an id of the image. Because I specified ‘some-mssql’ as the name, the image can be managed and accessed through this id as well as the name.