---
title: Database clones for traditionally installed SQL Servers
description: Windocks delivers database clones and attaches them automatically to traditionally installed SQL Servers.
---

 

 

 TECHNICAL DOCS

# Database clones for traditionally installed SQL Servers

Windocks delivers database clones and attaches them automatically to traditionally installed SQL Servers. See the sample in windocks\samples\windocksCloneToSqlInstance

#### [Prerequisites](https://23302346.hs-sites.com/doc-sql-instance#step1)

#### [Create the dockerfile](https://23302346.hs-sites.com/doc-sql-instance#step2)

#### [Build the image](https://23302346.hs-sites.com/doc-sql-instance#step3)

#### [Create a container from the image](https://23302346.hs-sites.com/doc-sql-instance#step4)

[View logs](https://23302346.hs-sites.com/doc-sql-instance#step5)

 

 

## Prerequisites

Prerequisities for the SQL Server instance you want the clone attached to:

- Create a SQL account that has a sysadmin role and note down the user name and password
- Allow remote connections
- Mixed authentication enabled

[Back to Top ](https://23302346.hs-sites.com/doc-sql-instance#getting-started) [Back to Technical Docs Gallery ](https://23302346.hs-sites.com/resources)

 

 

## Create the dockerfile

Create the dockerfile as follows:

**dockerfile**

FROM mssql-2017

ENV USE_DOCKERFILE_TO_CREATE_CONTAINER=1

# This line specifies that the technology for cloning is Windocks, replace the machine name and windows account below, leae ahte rest of the line as is  
RUN SourceClone_Windocks NetworkShareName|$ContainerId$ContainerImageName NetworkSharePath|C:\Windocks\data\$ContainerId\$ContainerImageName NetworkShareUsers|YOURMACHINENAME\YourWindowsAccount

# This line specifies that the target where the clone is attached is a SQL Instance  
RUN TargetAttach_SqlWindows InstanceName|$SqlInstanceName SqlUserName|$SqlInstanceUserName SqlPassword|$SqlInstancePassword

# This line sets up the image to deliver clones of the customer database to each container  
SETUPCLONING FULL customers C:\windocks\dbbackups\customerdatafull.bak

 

 

[Back to Top ](https://23302346.hs-sites.com/doc-sql-instance#getting-started) [Back to Technical Docs Gallery ](https://23302346.hs-sites.com/resources)

 

 

## Build the image

Build the image from the above dockerfile. This will create an image and apply the script maskingScript.sql to it

In a command line on the Windocks server:  
**docker build -t yourimagename path\to\directory\containing\dockerfile**

Alternatively, use the web application and click on Build in the top menu and click Browse. Select all the files in the directory (dockerfile, any script files) and then Open. Then click Build.

You may also use the [REST API](https://23302346.hs-sites.com/rest-api) to build the image

[Back to Top ](https://23302346.hs-sites.com/doc-sql-instance#getting-started) [Back to Technical Docs Gallery ](https://23302346.hs-sites.com/resources)

 

 

## Create a container from the image

This can be done using a command line below (only on the Windocks machine), or the web application (enter the SQL user name and password for the SQL instance) or from the REST API

In a command line on the Windocks server:  
**docker create --name SqlInstance_uniquename -e $SqlInstanceName="YourMachineNameRunningSqlInstance\YourSqlInstanceName" –e $SqlInstanceUserName="YourSqlUserName" –e $SqlInstancePassword="YourSqlPassword" YourImageName**

Make sure the name starts with SqlInstance_

The Sql user name and password should be for an Sql acccount that is a sysadmin on the target Sql Server instance.

The Sql server port on the machine running the SQL instance should be open in the firewall on that machine.

This will deliver a container with a writeable database clone of the customers database and the script scriptToRunAtContainerCreateTime.sql applied to the database.

You may also create containers with the clones from the web application at ServerIp:/index.html or the file windocks\ui\index.html in Chrome or Firefox.

You may also create containers with the REST API [here.](https://23302346.hs-sites.com/rest-api)

 

 

[Back to Top ](https://23302346.hs-sites.com/doc-sql-instance#getting-started) [Back to Technical Docs Gallery ](https://23302346.hs-sites.com/resources)

 

 

## View logs

View logs of the scripts in the web application by clicking log next to your container / clone.

[Back to Top ](https://23302346.hs-sites.com/doc-sql-instance#getting-started) [Back to Technical Docs Gallery ](https://23302346.hs-sites.com/resources)

## Extend CI/CD to your data layer

[GET A DEMO ](https://23302346.hs-sites.com/schedule-demo) [TRY FREE ](https://23302346.hs-sites.com/try-free)