Direct naar content

SQL Server draaien op Docker deel 1 De Basis

Inspired by my colleague Craig and his blogs about running PostgreSQL in Docker, I was curious if this could also be done with a SQL Server database. The short answer? It could. The long answer? For that, you’ll have to read on.

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:

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.