Book Image

Learning Windows Server Containers

Book Image

Learning Windows Server Containers

Overview of this book

Windows Server Containers are independent, isolated, manageable and portable application environments which are light weight and shippable. Decomposing your application into smaller manageable components or MicroServices helps in building scalable and distributed application environments. Windows Server Containers have a significant impact on application developers, development operations (DevOps) and infrastructure management teams. Applications can be built, shipped and deployed in a fast-paced manner on an easily manageable and updatable environment. Learning Windows Server Containers teaches you to build simple to advanced production grade container based application using Asp.Net Core, Visual Studio, Azure, Docker and PowerShell technologies. The book teaches you to build and deploy simple web applications as Windows and Hyper-V containers on Windows 10 and Windows Server 2016 on Azure. You will learn to build on top of Windows Container Base OS Images, integrate with existing images from Docker Hub, create custom images and publish to Hub. You will also learn to work with storage containers built using Volumes and SQL Server as container, create and configure custom networks, integrate with Redis Cache containers, configure continuous integration and deployment pipelines using VSTS and Git Repository. Further you can also learn to manage resources for a container, setting up monitoring and diagnostics, deploy composite container environments using Docker Compose on Windows and manage container clusters using Docker Swarm. The last chapter of the book focuses on building applications using Microsoft’s new and thinnest server platform – Nano Servers.
Table of Contents (19 chapters)
Credits
Foreword
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Preface

Containers is the next breakthrough in building modern and cloud based applications, comparing it with its predecessors like VM virtualization one would realize that containerization is the fastest, most resource-efficient, scalable, and secure way of building application hosting environments we know so far. Learning Windows Server Containers take you through a long and profound journey of building containerized ASP.NET applications on latest windows server platforms using Docker command line and Docker REST API. The book shows you how to build and ship containers from one environment to other with less hassle during the continuous integration and delivery process. You will learn to build containerized applications using scalable storage containers, cache containers with isolation levels like in VMs. The book helps you build an ecosystem of container hosts, manage composite container deployments, and resource governance.

What this book covers

Chapter 1, Exploring Virtualization, teaches you different virtualization levels, challenges with each type of virtualization, containers as a virtualization platform, and benefits of running containerized applications, tooling support, other container platforms available in market today.

Chapter 2, Deploying First Container, teaches you to set up development environment, understand the Docker terminology, installing images from Docker Hub, create custom windows container images using Docker CLI and authoring Dockerfile.

Chapter 3, Working with Container Images, will introduce you to common container management tasks such as listing the containers, start/stop, cleaning up unused containers or images using Docker CLI on Windows Server environment.

Chapter 4, Developing Container Applications, teaches you to create and deploy ASP.NET Core Web applications using Visual Studio 2015, .NET Core, and C# to Windows Server 2016 Core as Windows Container using PowerShell and Docker CLI.

Chapter 5, Deploying Container Applications, teaches you to create Windows Server Container environment on Azure using Azure Resource Manager templates and Azure PowerShell, configure remote management for container hosts, deploy container applications remotely as Windows Containers and Hyper-V containers, configuring software load balancer and so on.

Chapter 6, Storage Volumes, talks about building file based storage based containers using Docker volumes and relational database containers using Microsoft SQL Server.

Chapter 7, Redis Cache Containers, teaches you to create persistent Redis Cache containers using Redis and storage volumes.

Chapter 8, Container Network, introduces you to Windows Container networks, different networking modes, building custom container networks using different networking modes and deploying containers on custom networks.

Chapter 9, Continuous Integration and Delivery, teaches you to build continuous integration and deployment pipelines for container applications using Visual Studio Team Services (TFS Online) on Azure, Docker Hub, and Git. You will learn to create a create a custom build server for building, packaging and releasing containers to windows container hosts.

Chapter 10, Manage Resource Allocation and REST API, teaches you to manage container resource utilization, create and manage containers using Docker REST API via Postman and C#, image optimization strategies and monitoring options available for containers and container hosts.

Chapter 11, Composite Containers and Clustering, teaches you to orchestrate multiple container deployments using Docker Compose, set up scaling for multicontainer environments and authoring Docker Compose service definition. Also, you will learn the concepts of cluster management using Docker Swarm and Azure Container Service.

Chapter 12, Nano Server, serves as an introduction to Windows Nano Server, building custom Nano Server images using PowerShell, deploying containers on Nano Server, working with Nano containers, and configuring Nano Server using PowerShell DSC.

What you need for this book

This book assumes basic knowledge of PowerShell, C#, .NET, ASP.NET 5, cloud computing, and Azure. The book will help your setup development environment on desktop operating system like Windows 10 (with Anniversary update) and deploying container applications on VMs running on-premise and on Azure. To practice building containerized applications on an on-premise environment like Windows 10, the host machine should have Hyper-V feature enabled. The book shows building virtual environments using Windows 10 built-in feature called Hyper-V but you can try any other desktop virtualization software like VMware or virtual box. The book also uses Visual Studio 2015 for application development, if you have hands-on experience working with Visual Studio 2015 it will easy to execute the samples. Following is the basic hardware configuration for running Hyper-V and Visual Studio 2015:

  • CPU: 1.6 GHz or faster processor, 4 cores
  • 64-bit processor with Second Level Address Translation (SLAT) – (for Hyper-V only)
  • CPU support for VM Monitor Mode Extension (VT-c on Intel CPU's) – (for Hyper-V only)
  • Minimum of 8 GB RAM
  • Disk space: 80 GB

Apart from the these, you will also need an Azure subscription for creating container environments on Azure. Microsoft offers a free subscription which can be used for 30 days in-case you do not have a paid subscription. The software requirements for the book are as follows:

  • Visual Studio 2015 (Community Edition or above)
  • Windows 10 with Anniversary update
  • SQL Server Management Studio
  • Redis Desktop Manager
  • Postman

Internet connectivity is required to install any packages for application development, download images (ISO files) for windows server 2016 or source code from GitHub repository.

Who this book is for

The primary target audience for this book would be developers who would like to use Windows Server Containers to build portable apps that can run anywhere (laptop, server, and public or private cloud) without little or no changes to the code. Developers will be able to build and ship high-quality applications. As Windows Containers has a broad impact on developers and administrators alike, this book will also help IT professionals or DevOps Engineers prepare infrastructure which is easy to use and maintain. IT professionals will be able to optimize resource utilization by increasing the density of applications per machine. The concepts discussed in this book also help DevOps develop a container mindset, establish practices around publishing developed code as containers from development environment to production easily.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The remove() method finds the first instance of the element (passed an argument) and removes it from the list."

Any command-line input or output is written as follows:

    docker search microsoft

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Click on Test Connection and ensure the connection is successful."

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

You can download the latest code samples from the code repository belonging to this book from the author's code repository at https://github.com/vishwanathsrikanth/learningwsc.

The code bundle for the book is also hosted on Packt's GitHub repository at https://github.com/PacktPublishing/Learning-Windows-Server-Containers. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.