Install SQL server on Linux CentOS Redhat create multiple Docker in laptop using VMware Workstation – Part 5


What is Docker container

In simple container is an image or package that will have binaries, configurations etc of the application to run on. Example – In a single OS you can run multiple containers, like CentOS SQL 2017 and 2019 version etc. It is very easy to install, once the image pulled and stored locally, creating SQL server is in a seconds, the advantage is you can create your own images based on the organization standards and store it in Docker HUB. Docker is a container engine developed by Docker to run a containers.

Being SQL server database administrator, mostly we will not worked on Linux platform, I have supported Oracle couple of years and have knowledge of Linux platform.

Following is the 6 steps we are going to test and do ourselves in laptop.

  1. Install VMware workstation and CentOS
  2. Install SQL server on Linux CentOS
  3. Create and install multiple Docker SQL server
  4. Create volumes with persist data for SQL server database files
  5. Customize base SQL server image with Docker file

Creating customized SQL container based the organization standard and push to Docker hub.

Create multiple container from Docker file template by using custom SQL server images.

Create multiple SQL server containers creation by using Docker compose with YML script.

  1. Backup and restore SQL server databases from Linux to windows



  1. Backup and restore SQL databases from Linux to windows vice versa

Backup your databases from windows server for testing your laptop, export using WinSCP and copy from Linux to container and restore it.

# Backup from windows SQL and restore it on linux container

Backup the database & export the backup from windows to Linux
Copy from linux to container & restore the database in the container

backup database DBAdata to disk ='D:\Backup_Copy\DBAdata.bak'
export using winscp

if you have container use it or create a new one.

docker run -e 'MSSQL_AGENT_ENABLED=True' -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=G0d$peed' -p 1533:1433 --name sql-linux_restoredb -d -h computer-3.broadband

docker cp DBAdata.bak <container id>:DBAdata.bak
docker cp DBAdata.bak 3364f39d5989:DBAdata.bak

docker exec -it <container id> bash
# enter into container and check the file exists
docker exec -it 3364f39d5989 bash

cp DBAdata.bak var/opt/mssql/data/DBAdata.bak

#  connect from ssms and restore it from the file we copied inside the container

USE [master]
RESTORE filelistonly FROM  DISK = N'/var/opt/mssql/data/DBAdata.bak' 

USE [master]
FROM  DISK = N'/var/opt/mssql/data/DBAdata.bak' 
WITH  FILE = 1,  
MOVE N'DBAdata' 
TO N'/var/opt/mssql/data/PRODUCTION.mdf',  
MOVE N'DBAdata_log' 
TO N'/var/opt/mssql/data/PRODUCTION.ldf',  


Referred link and videos: Thanks to them for making me to test.–part-1/

Udemy: Raphael Asghar




I’m currently working as a SQL server DBA in one of the top MNC. I’m passionate about SQL Server And I’m specialized in Administration and Performance tuning. I’m an active member of SQL server Central and MSDN forum. I also write articles in SQL server Central. For more Click here

Leave a Reply

Your email address will not be published. Required fields are marked *

18 + = 24