When I need a SQL Server backend for development I often just run up a LocalDB instance. When I want to test something SQL Server related, I’ll spin up a developer instance which was never a quick task before. Docker and containers have made that process a lot easier.
In this blog I’ll show you how to get SQL Server up and running. At the time of writing I still believe SQL Server in containers is not fully production ready and it will take a few more years before companies are fully versed in managing this infrastructure.
The first thing you need to do is install the community edition of the Docker for Windows. Make sure you read the machine pre-requisites. I am using Windows 10, 1709 build.
Once installed a whale icon will appear in the system tray. Right click it and select About Docker.
This is the version I have at the time of writing.
Right click again and if you see “Switch to Windows Containers”, then click it or you will not be able to run any windows containers.
The next step is to change some settings. Right click and select Settings. Click on Daemon and then move the switch to Advanced.
This is a JSON formatted file. A couple of options I set are:
- Graph. When containers are pulled from the docker registry, it uses this location to store them. These are GB’s in size and so I use my T drive SSD. Without this parameter set, containers would be stored in %LOCALAPPDATA%\Docker.
- Fixed-cidr. This sets the subnet for allocating IP addresses to my containers. This is the subnet of my machine.
The settings are stored in C:\ProgramData\Docker\config\daemon.json.
Docker Log Files
Docker has many moving parts and knowing where the log files are kept will help troubleshooting easier.
The logs files are kept in:
Testing Docker is Running
The installation adds the Docker CLI and sets the path. From a command prompt run docker version. If all goes well you should see the output below. Again from here we also see the architecture is windows and not Linux.
The location of the docker command is C:\Program Files\Docker\Docker\Resources\bin\docker.exe in the event the path is not set up correctly.
Running docker without any parameters will show the help page.
In the next blog ill show how to get the latest SQL Server image.