×
Install MSSQL Server 2016 in Windows Container
Blog Containers

Install MSSQL Server 2016 in Windows Container

Install MSSQL Server 2016 in Windows Container

In this blog, we will show you how to install MSSQL Server 2016 in Windows Container using windows server core image.

 

REQUIREMENTS

  • Windows Container Host with docker installed
  • SQL Installation Files
  • Windows 2016 Server Core container image

 

Note: In this demonstration, we are using windows container host as VM using nested virtualization

 

DOWNLOAD MSSQL

 

Install MSSQL Server 2016 in Windows Container

 

  • It will download an executable file named SQLServer2016-SSEI-Eval.exe.

Install MSSQL Server 2016 in Windows Container

 

  • Double Click on the executable as shown below.

Install MSSQL Server 2016 in Windows Container

 

  • Click on Download Media option and select the language, package type & download location. Then Click Download.

Install MSSQL Server 2016 in Windows Container

 

  • MSSQL image will start download it will take several minutes to complete.

Install MSSQL Server 2016 in Windows Container

 

  • Once the download is complete, mount the MSSQL ISO.

Install MSSQL Server 2016 in Windows Container

 

  • Copy the setup files into a folder named SQL2016.

 

Install MSSQL Server 2016 in Windows Container

 

Install MSSQL Server 2016 in Windows Container

 

 

DOTNET SETUP FILES

  • Mount the Windows 2016 ISO on container host VM.

Install MSSQL Server 2016 in Windows Container

 

  • Right on D: drive and click on open.

Install MSSQL Server 2016 in Windows Container

 

  • Go to sources folder and copy the sxs folder to C:\SQL2016 folder.

Install MSSQL Server 2016 in Windows Container

 

Install MSSQL Server 2016 in Windows Container

 

GENERATING UNATTENDED FILE FOR MSSQL INSTALLATION

  • There are several ways to generate unattended file MSSQL installation. We ran the MSSQL installation setup wizard to collect the configuration data for the unattended installation.

Install MSSQL Server 2016 in Windows Container

 

  • Copy the Configuration file to C:\SQL2016 folder.

Install MSSQL Server 2016 in Windows Container

 

  • We have uploaded our configurationfile in github repository. Please use the below URL to download it.

https://github.com/assistanz247/MSSQL2016/blob/master/ConfigurationFile.ini

 

Install MSSQL Server 2016 in Windows Container

 

INSTALLING MANAGEMENT STUDIO

  • Open the web browser and access the below URL.

https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms

 

  • Click on Download SQL Server Management Studio – 17.0 link.

Install MSSQL Server 2016 in Windows Container

 

  • Once its download, double-click on the installation file. It shows the welcome page of the installation wizard. Click on Install button.

Install MSSQL Server 2016 in Windows Container

 

  • It will take several minutes to complete the installation.

Install MSSQL Server 2016 in Windows Container

 

  • Click Close to complete the installation.

Install MSSQL Server 2016 in Windows Container

 

CREATING CONTAINER FOR MSSQL

  • We have already pulled the windows server core image from docker hub.

Install MSSQL Server 2016 in Windows Container

 

  • Launch a MSSQL container using the below command.

docker run -it –name sql -p 1433:1433 -v c:\sql2016:c:\sql microsoft/windowsservercore:latest cmd

Install MSSQL Server 2016 in Windows Container

docker run – It’s a sub-command to execute the docker commands.

-it – To run interactive session.

-p 1433:1433 – Binds port 1433 on the host to port 1433 on the container.

-v c:\sql2016:c:\sql – Mapping the source folder from container host (C:\sql2016) to destination folder (C:\sql) inside the container.

microsoft/windowsservercore:latest – container image with the latest tag.

cmd – Execute a process (command prompt) in the container.

 

  • After few seconds, the container will create as shown below.

Install MSSQL Server 2016 in Windows Container

 

  • Verify the SQL folder is available using directory listing command.

Install MSSQL Server 2016 in Windows Container

 

INSTALL DOTNET FEATURE

  • For pre-requisites, we need to install ASP.NET feature before installing MSSQL server. Execute the below command to install this feature.

Install-WindowsFeature -Name net-framework-features -IncludeAllSubFeature -Source C:\sql\sxs\

Install MSSQL Server 2016 in Windows Container

 

  • It will take few minutes to complete the installation.

Install MSSQL Server 2016 in Windows Container

 

INSTALL MSSQL SERVER

  • Execute the below command, to install MSSQL in unattended mode from the command prompt.

Install MSSQL Server 2016 in Windows Container

 

  • It will take several minutes to complete the installation. Once it’s completed it returns back to command prompt.

Install MSSQL Server 2016 in Windows Container

 

Note : In this demonstration, we set sa useraccount password as test@123

  • At last, set the SQL server service to run under LocalSystem using the below command.

sc config MSSQLSERVER obj=LocalSystem

Install MSSQL Server 2016 in Windows Container

 

VERIFYING THE INSTALLATION

  • In the remote VM (outside the container host), Go to start menu and click on Microsoft SQL Management Studio.

Install MSSQL Server 2016 in Windows Container

 

  • In the server connect dialog box, provide the container host IP address and sa account credentials.

Install MSSQL Server 2016 in Windows Container

 

  • If the MSSQL is installed correctly, we will able to logged into the MSSQL container successfully.

Install MSSQL Server 2016 in Windows Container

 

  • You need to use the container IP to access the MSSQL server from the container host. Go to the container and type ipconfig to verify the IP address.

Install MSSQL Server 2016 in Windows Container

 

  • Open the Microsoft SQL Management Studio from the container host and provide the below details.

Server IP: 172.28.230.44

Username: sa

Password: <sa account password>

Install MSSQL Server 2016 in Windows Container

 

  • After successful authentication, you will able to view the MSSQL server using container IP.

Install MSSQL Server 2016 in Windows Container

 

SAVING CONTAINER AS IMAGE

  • Go-to container, and press ctrl+pq keys to disconnect from the container.

Install MSSQL Server 2016 in Windows Container

 

  • Type docker ps command to verify the container state.

Install MSSQL Server 2016 in Windows Container

 

  • Execute the docker stop command to stop the container.

Install MSSQL Server 2016 in Windows Container

  • Save the image using docker commit command.

docker commit sql mssql2016

Install MSSQL Server 2016 in Windows Container

 

  • Type docker images command to verify the MSSQL container image.

Install MSSQL Server 2016 in Windows Container

 

VIDEO

 

Thanks for reading this blog. We hope it was useful for you to learn how to install SQL server on windows container.

One thought on “Install MSSQL Server 2016 in Windows Container”

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.