How to provision a windows container in Azure?
In this article, we will see how to provision a windows container on Azure and how to run a SQL SERVER within a windows container.
A little bit of background, container technology has been implemented in Linux world for many years but it was not as important as now. Docker Inc., a tech company based in SF sponsored the Docker project at 2013 and now millions of developers around the world are using this amazing technology on their daily job for a faster software shipment. Microsoft recently has included container support in Windows Server 2016 and higher versions in the form of Windows Containers.
First, we need to deploy a Windows Server 2016 with Containers on Azure. In order to work on Azure portal, you need an azure account and once you sign up you will get $250 credit (The credit amount may change in the future) which is more than enough for provisioning a windows container.
After the login to Azure portal, we need to add Windows Server 2016 with Containers.
Click on Windows Server 2016 Datacenter with Containers.
Click on Create.
In this step we need to provide details of the VM e.g. name, disk type, user name and password. Click Ok to select the size next.
Here select the size that fits your requirement. I have the first option selected.
Step 3 requires more details e.g. Storage, Network etc. Click Ok after providing all necessary items.
After viewing the summary click Ok. At this stage, Azure starts deploying the VM.
It may take a couple of minutes and after deployment you will see the successful notification in the portal.
Now, our VM is up and running and we can RDP to it by clicking on the Connect button to download the RDP connection information.
After logging into the VM, click Windows Power Shell.
In the PowerShell console, type docker version and press ENTER to see docker server and docker client version.
As you can see docker server OS/Arch is Windows/amd64. There are some images that comes with Windows Server 2016 with Containers on Azure e.g. windowsservercore
Now, in order to run SQL SERVER on a Windows Container we need to pull the image from docker hub.
After couple of minutes, pulling SQL SERVER will be completed.
In the PowerShell console type docker images and press ENTER to see installed image.
Now that we have pull the image, let’s run it using below command and defined parameters:
docker run -it -p 1433:1433 -e sa_password=P@ssw0rd -e ACCEPT_EULA=Y microsoft/mssql-server-windows-express
After couple of seconds our SQL SERVER is up and running in a Windows Container.
Let’s run docker ps command to get the list of running containers.
So, as you can see our container is up and running. Now let me show you how to connect to this container from your local machine using SQL SERVER STUDIO MANAGEMENT. We need to open port 1433 to windows server 2016 VM in Azure in order to connect to the database.
This article show how to open a port in azure VM and you would open port 1433.
After opening the port you can login to the database in the container using SQL SERVER MANGEMETNT STUDIO.
Now, let me stop the container.
And I am getting a network error when running a query to the database.
To sum up, in this article, we saw how to provision a windows container on Azure and how to run a SQL SERVER within a windows container.
Number of Views:1370