Book Image

Troubleshooting Docker

By : Vaibhav Kohli, Rajdeep Dua, John Wooten
Book Image

Troubleshooting Docker

By: Vaibhav Kohli, Rajdeep Dua, John Wooten

Overview of this book

You?re pro Docker? You?ve read all about orchestration with Docker in books? Now learn how to troubleshoot Docker in practice. Gain all the tools to safely see Docker in action with this 2017 book.
Table of Contents (17 chapters)
Troubleshooting Docker
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Free Chapter
1
Understanding Container Scenarios and an Overview of Docker

Preface

Docker is an open source, container-based platform that enables anyone to consistently develop and deploy stable applications anywhere. Docker delivers speed, simplicity, and security in creating scalable and portable environments for ultramodern applications. With the advent and prevalence of Docker in the containerization of modern microservices and N-tier applications, it is both prudent and imperative to effectively troubleshoot automated workflows for production-level deployments.

What this book covers

Chapter 1, Understanding Container Scenarios and an Overview of Docker, is about the basic containerization concept with the help of application and OS-based containers. We will throw some light on the Docker technology, its advantages, and the life cycle of Docker containers.

Chapter 2, Docker Installation, will go over the steps to install Docker on various Linux distributions – Ubuntu, CoreOS, CentOS, Red Hat Linux, Fedora, and SUSE Linux.

Chapter 3, Building Base and Layered Images, teaches that a mission-critical task in production-ready application containerization is image building. We will also discuss building images manually from scratch. Moving ahead, we will explore building layered images with a Dockerfile and enlist the Dockerfile commands in detail.

Chapter 4, Devising Microservices and N-Tier Applications, will explore example environments designed seamlessly from development to test, eliminating the need for manual and error-prone resource provisioning and configuration. In doing so, we will touch briefly on how a microservice applications can be tested, automated, deployed, and managed.

Chapter 5, Moving Around Containerized Application, will take a look at Docker registry. We will start with the basic concepts of Docker public repository using Docker Hub and the use case of sharing containers with a larger audience. Docker also provides the option to deploy a private Docker registry, which we look into, that can be used to push, pull, and share the Docker containers internally in the organization.

Chapter 6, Making Containers Work, will teach you about privileged containers, which have access to all the host devices, and super-privileged containers, which show that the containers can run a background service that can be used to run services in Docker containers to manage the underlying host.

Chapter 7, Managing the Networking Stack of a Docker Container, will explain how Docker networking is powered with Docker0 bridge and its troubleshooting issues and configuration. We will also look at troubleshooting the communication issues between Docker networks and the external network. We look into containers communication across multiple hosts using different networking options, such as Weave, OVS, Flannel, and Docker's latest overlay network. We will compare them and look at the troubleshooting issues involved in their configuration.

Chapter 8, Managing Docker Containers with Kubernetes, explains how to manage Docker containers with help of Kubernetes. We will cover many deployment scenarios and troubleshooting issues while deploying Kubernetes on a Bare Metal machine, AWS, vSphere, or using minikube. We will also look at deploying Kubernetes pods effectively and debugging Kubernetes issues.

Chapter 9, Hooking Volume Baggage, will dive into data volumes and storage driver concepts related to Docker. We will discuss troubleshooting the data volumes with the help of the four approaches and look at their pros and cons. The first case of storing data inside the Docker container is the most basic case, but it doesn't provide the flexibility to manage and handle data in the production environment. The second and third cases are about storing the data using data-only containers or directly on the host. The fourth case is about using a third-party volume plugin, Flocker or Convoy, which stores the data in a separate block and even provides reliability with data, even if the container is transferred from one host to another or if the container dies.

Chapter 10, Docker Deployment in a Public Cloud - AWS and Azure, outlines Docker deployment on the Microsoft Azure and AWS public clouds.

What you need for this book

You will need Docker 1.12+ installed on Windows, Mac OS,or Linux machines. Public cloud accounts of AWS, Azure and GCE might be required, which are mentioned in the respective sections of the chapters.

Who this book is for

This book is intended to help seasoned solutions architects, developers, programmers, system engineers, and administrators troubleshoot common areas of Docker containerization. If you are looking to build production-ready Docker containers for automated deployment, you will be able to master and troubleshoot both the basic functions and the advanced features of Docker. Advanced familiarity with the Linux command line syntax, unit testing, the Docker registry, GitHub, and leading container hosting platforms and Cloud Service Providers (CSP) are the prerequisites. In this book you will also learn about ways and means to avoid troubleshooting in the first place. 

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: "Restart the cluster using the start_k8s.sh shell script."

A block of code is set as follows:

ENTRYPOINT /usr/sbin/sshd -D 
VOLUME ["/home"] 
EXPOSE 22 
EXPOSE 8080

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

Docker build -t username/my-imagename -f /path/Dockerfile

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: "Specify the Stack name, KeyPair, and cluster 3."

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/Troubleshooting-Docker. 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.