SQL Server and Containers

The concept of virtual machines has been around for some time, but at Microsoft I really didn’t see customers start to use SQL Server as a database platform on virtual machines until around the 2006 to 2007 timeframe. Even when virtual machine environment

  • PDF / 1,437,191 Bytes
  • 41 Pages / 504 x 720 pts Page_size
  • 96 Downloads / 326 Views

DOWNLOAD

REPORT


SQL Server and Containers The concept of virtual machines has been around for some time, but at Microsoft I really didn’t see customers start to use SQL Server as a database platform on virtual machines until around the 2006 to 2007 timeframe. Even when virtual machine environments such as Hyper-V and VMWare started to become popular, I was skeptical SQL Server would run well in a guest virtual machine. Today, SQL Server is probably deployed in virtual machines far greater than on a bare metal computer. I see containers as the new virtual machine. But the excitement and adoption of containers with application and database platforms like SQL Server are growing faster than I ever saw with virtual machines. In this chapter, I’m going to provide you with an introduction to containers, and then a fairly deep discussion and set of examples of how to use containers with SQL Server. Then I’ll conclude the chapter with a fun example of using SQL Server on macOS (Mac users probably thought I had ignored them in this book) and a discussion of how to use SQL Server in the container platform called Kubernetes. I think you will enjoy this chapter. It was one of my favorite chapters to write in the book.

Introduction to Containers While virtual machines are best defined as hardware virtualization, containers (or containerization) are defined as operating system virtualization. A virtual machine consists of a complete operating system (guest) running on a host machine (bare metal hardware). Therefore, it is common for a host machine to host several virtual machines. Each virtual machine could be running a different guest operating system.

© Bob Ward 2018 B. Ward, Pro SQL Server on Linux, https://doi.org/10.1007/978-1-4842-4128-8_11

545

Chapter 11

SQL Server and Containers

Containers rely on a single host operating system (which could be a virtual machine) sharing kernel resources. This makes containers more lightweight than virtual machines. Even though containers share a single operating system kernel, containers are isolated from each other. I love the following visual diagram as seen in Figure 11-1, which I found at https://i.stack.imgur.com/exIhw.png to show the difference between containers and virtual machines.

Figure 11-1.  Containers vs. virtual machines In addition, this stackoverflow.com post is a great description of the differences between virtual machines and containers: https://stackoverflow.com/ questions/16047306/how-is-docker-different-from-a-virtual-machine. One comment about this posting: the posting describes the use of a Union File System (UnionFS) called AuFS. UnionFS is an important concept for Docker containers because it supports a layered file system. Current releases of Docker still use a UnionFS, but now use a system called OverlayFS. You can read more about OverlayFS at https://docs. docker.com/storage/storagedriver/overlayfs-driver. Docker containers are created using images, which specify the contents of the filesystem and what runs in the container. A container then is an instance of an ima