Book Image

Docker Orchestration

By : Randall Smith
Book Image

Docker Orchestration

By: Randall Smith

Overview of this book

Docker orchestration is what you need when transitioning from deploying containers individually on a single host to deploying complex multi-container apps on many machines. This book covers the new orchestration features of Docker 1.12 and helps you efficiently build, test, and deploy your application using Docker. You will be shown how to build multi-container applications using Docker Compose. You will also be introduced to the building blocks for multi-host Docker clusters such as registry, overlay networks, and shared storage using practical examples. This book gives an overview of core tools such as Docker Machine, Swarm, and Compose which will enhance your orchestration skills. You’ll learn how to set up a swarm using the decentralized building block. Next, you’ll be shown how to make the most out of the in-built orchestration feature of Docker engine and you’ll use third-party tools such as Kubernetes, Mesosphere, and CoreOS to orchestrate your existing process. Finally, you will learn to deploy cluster hosts on cloud services and automate your infrastructure.
Table of Contents (17 chapters)
Docker Orchestration
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Preface

Docker containers are a powerful tool for building and deploying services consistently and reliably. As the number of containers increases, they also become a problem to manage. The problem is only exasperated when the containers are run on multiple hosts. This book shows you how to get started bringing order to the chaos through orchestration.

This book starts by showing you how to get started with Docker then delves into the building blocks that are needed for a Docker cluster. It shows you how to use the "Big Three" orchestration tools—Docker Swarm, Kubernetes, and Mesosphere. It will also introduce two additional tools, Fleet and Cattle, which can be simpler to use and install, but very powerful.

Finally, you will be introduced to tools that make life simpler for people managing clusters and developers creating images that will be run. You will explore tools to monitor clusters and see where the performance bottlenecks are. You will see how to use continuous integration to consistently and reliably build, test, and deploy Docker images. Finally, this book will show you how to apply the same principles to the hosts that Docker is running on.   

What this book covers

Chapter 1, Getting Started with Docker Orchestration , gets you started with using Docker. It shows you how to install Docker locally and on popular cloud services such as Amazon Web Services, Google Compute Engine, and Microsoft Azure.

Chapter 2, Building Multi-Container Applications with Docker Compose , provides an introduction to building multi-container applications with Docker Compose. It also shows how to use named networks for data isolation and data volumes to share data.

Chapter 3 , Cluster Building Blocks – Registry, Overlay Networks, and Shared Storage , describes the building blocks that are needed for a Docker cluster. You will explore the registry, overlay networks, and shared storage and learn why they are needed.

Chapter 4 , Orchestration with Docker Swarm , shows you how to create and manage a cluster with Docker Swarm. You will learn how to manage services, run them with multiple replicas, and perform "zero downtime" upgrades.

Chapter 5 , Deploying and Managing Services with Kubernetes , explores the basics of using Kubernetes to orchestrate a Docker cluster. You will see how to create services provided by multiple containers, how to provide load balancing for those services, and how to seamlessly upgrade them. Finally, you will see how to create persistent volumes to share data between containers.

Chapter 6 , Working with Mesosphere , delves into using Mesosphere and DC/OS for orchestration. You will learn how to create and manage containers, load-balance them, and provide persistent storage. You will also see how to create health checks to ensure that services are running properly and how to perform "zero downtime" upgrades.

Chapter 7 , Using Simpler Orchestration Tools – Fleet and Cattle, takes a look Fleet and Cattle. Fleet is a low-level tool that can be used to base custom management tools on. Cattle is a powerful, but easy to use, orchestration tool from Rancher. You will see how to use each to manage containers and services.

Chapter 8 , Monitoring Your Cluster , explores the important task of ensuring that clusters, and containers running in them, are behaving properly. You will learn how to aggregate logs from all your containers in Elasticsearch and view them in Kibana. You will also learn how to use collectd, InfluxDB, and Grafana to collect performance data.

Chapter 9 , Using Continuous Integration to Build, Test, and Deploy Containers , explains how to use continuous integration in GitLab to build, test, and even deploy containers. This helps to ensure that images are built consistently and reliably.

Chapter 10 , Why Stop at Containers? Automating Your Infrastructure , looks beyond containers to show how the same principles that go into building and orchestrating Docker containers can also be used with the hosts those containers run on. You will see how configuration management can be used to configure hosts and ensure that they stay configured. The chapter also shows you how to use Packer to build host images that can be deployed locally or to cloud services. Finally, it will introduce Terraform, which can be used to create an entire Docker cluster from scratch.

What you need for this book

You will need a place to run Docker hosts. This can be in a local cluster such as OpenStack or a cloud hosting provider such as Amazon EC2, Google Compute Engine, or Microsoft Azure. The first chapter shows you how to install Docker on Linux and the rest of the book assumes that the tools are run from Linux. Ubuntu, CentOS, and Red Hat Enterprise Linux are, currently, the best supported.

A text editor, such as Emacs, will be needed as most orchestration tools store their configurations in text files. Many of the tools and examples described within this book require a web browser to access.

Who this book is for

This book is for developers and system administrators who have a basic knowledge of Docker and now want to deploy and manage containers across multiple hosts.

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: "Containers are started using docker run command."

A block of code is set as follows:

#cloud-config 
users: 
  - name: "demo" 
    passwd: "$6$HpqJOCs8XahT$mSgRYAn..." 
    groups: 
    - "sudo" 
    - "docker"

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

#cloud-config 
users: 
  - name: "demo" 
    passwd: "$6$HpqJOCs8XahT$mSgRYAn..." 
    groups: 
    - "sudo" 
    - "docker"

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

$ wget -qO - https://get.docker.com/ | sh

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: "Select your account then click Allow on the next page."

Note

Warnings or important notes appear in a box like this.

Tip

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

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Docker-Orchestration. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/DockerOrchestration_ColorImages.pdf.

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.