Troubleshooting Docker

Book description

Strategically design, troubleshoot, and automate Docker containers from development to deployment

About This Book

  • Utilize current and emergent technologies for effective Docker orchestration and management
  • A step-by-step guide to diagnosing and fixing problems with Docker containers.

Who This Book Is For

This book is intended for seasoned solutions architects, developers, and programmers, system engineers, and administrators to help you 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.

What You Will Learn

  • Install Docker ecosystem tools and services, Microservices and N-tier applications
  • Create re-usable, portable containers with help of automation tools
  • Network and inter-link containers
  • Attach volumes securely to containers
  • Consume and troubleshoot Docker APIs
  • Troubleshooting issue of Docker deployment in Public cloud
  • Ease the process of container management with Kubernetes

In Detail

This book will traverse some common best practices to for complex application scenarios where troubleshooting can be successfully employed to provide the repeatable processes and advantages that containers can deliver.

This book will be a practical guide showing how to fix real-life issues related to installation, memory, Dockerfile syntax, connection, authorization, networking and so on in Docker. This book will also teach how to solve errors that occur during advanced setup and administration and deployment in a step-by-step fashion. By sequentially working through the real-world production scenarios in each chapter throughout the book, you will gain insight into and mastery of common areas not only for effective troubleshooting, but ways and means to avoid troubleshooting in the first place. This book will also cover tips and tricks that make the workflow easier.

Style and approach

An easy-to-follow guide full of interactive examples of real-world development and deployment scenarios.

Ample screenshots, workflows, complementary tools, and related terminal commands are provided to address a wide range of practical and situational applications.

Table of contents

  1. Troubleshooting Docker
    1. Troubleshooting Docker
    2. Credits
    3. About the Authors
    4. About the Reviewer
    5. www.PacktPub.com
      1. Why subscribe?
    6. Customer Feedback
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Understanding Container Scenarios and an Overview of Docker
      1. Decoding containers
        1. OS containers
        2. Application containers
        3. Diving into Docker
        4. Advantages of Docker containers
        5. Docker lifecycle
        6. Docker design patterns
          1. Base image sharing
          2. Shared volume
          3. Development tools container
          4. Test environment containers
          5. The build container
          6. The installation container
          7. The service-in-a-box container
          8. Infrastructure containers
      2. Unikernels
      3. Summary
    9. 2. Docker Installation
      1. Installing Docker on Ubuntu
        1. Prerequisites
        2. Updating package information
        3. Adding a new GPG key
        4. Troubleshooting
        5. Adding a new package source for Docker
        6. Updating Ubuntu packages
        7. Install linux-image-extra
        8. Optional - installing AppArmor
        9. Docker installation
      2. Installing Docker on Red Hat Linux
        1. Checking kernel version
        2. Updating the YUM packages
        3. Adding the YUM repository
        4. Installing the Docker package
        5. Starting the Docker service
        6. Testing the Docker installation
        7. Checking the installation parameters
        8. Troubleshooting tips
      3. Deploy CentOS VM on AWS to run Docker containers
        1. Checking kernel version
        2. Updating the YUM packages
        3. Adding the YUM repository
        4. Installing the Docker package
        5. Starting the Docker service
        6. Testing the Docker installation
        7. Checking the installation parameters
      4. Installing Docker on CoreOS
        1. Installation channels of CoreOS
        2. Troubleshooting
      5. Installing Docker on Fedora
        1. Checking Linux kernel Version
        2. Installing with DNF
        3. Adding to the YUM repository
        4. Installing the Docker package
      6. Installing Docker with script
        1. Running the Docker installation script
      7. Installing Docker on SUSE Linux
        1. Launching the SUSE Linux VM on AWS
        2. Checking Linux kernel version
        3. Adding Containers-Module
        4. Installing Docker
        5. Starting Docker service
        6. Checking the Docker installation
        7. Troubleshooting
      8. Summary
    10. 3. Building Base and Layered Images
      1. Building container images
        1. Official images from the Docker Registry
          1. User repositories
        2. Building our own base images
          1. Building images using the scratch repository
        3. Building layered images
          1. Building layered images using Dockerfiles
            1. Dockerfile construction
            2. Dockerfile commands and syntax
      2. Image testing and debugging
        1. Docker details for troubleshooting
        2. Docker version
        3. Docker info
        4. A troubleshooting note for Debian/Ubuntu
        5. Listing installed Docker images
        6. Manually crank your Docker image
        7. Examining the filesystem state from cache
        8. Image layer IDs as debug containers
        9. Additional example
        10. Checking failed container processes
        11. Other potentially useful resources
        12. Using sysdig to debug
          1. Single step installation
          2. Advanced installation
          3. What are chisels?
        13. Troubleshooting - an open community awaits you
      3. Automated image building
        1. Unit tested deployments
        2. Automating tested deployments
      4. Summary
    11. 4. Devising Microservices and N-Tier Applications
      1. Hype or hubris
      2. Monolithic architecture
      3. N-tier application architecture
        1. Building a three-tier web application
      4. Microservices architecture
        1. The path to modernity
          1. Microservices architectural pattern
          2. Common characteristics of microservices
          3. Advantages of microservices
          4. Microservices at scalability
          5. Disadvantages of microservices
          6. Considerations for devising microservices
            1. Mitigating the disadvantages
        2. Managing microservices
          1. Real-world example
        3. Automated tests and deployments
          1. Automated testing
            1. Designing for failure
            2. Dockunit for unit tests
          2. Automated deployments
        4. Decoupling N-tier applications into multiple images
          1. Building an N-tier web application
        5. Making different tiers of applications work
      5. Summary
    12. 5. Moving Around Containerized Applications
      1. Redistributing via Docker registry
        1. Docker public repository (Docker Hub)
        2. Private Docker registry
      2. Pushing images to Docker Hub
        1. Installing a private local Docker registry
        2. Moving images in between hosts
        3. Ensuring integrity of images - signed images
      3. Docker Trusted Registry (DTR)
      4. Docker Universal Control Plane
      5. Summary
    13. 6. Making Containers Work
      1. Privileged containers
        1. Troubleshooting tips
      2. Super-privileged container
        1. Troubleshooting - Docker containers at scale
      3. Puppet
        1. Images
        2. Containers
        3. Networking
        4. Docker compose
        5. Troubleshooting tips
      4. Ansible
        1. Automating Docker with Ansible
        2. Ansible Container
        3. Troubleshooting tips
      5. Chef
      6. Summary
    14. 7. Managing the Networking Stack of a Docker Container
      1. Docker networking
      2. docker0 bridge
        1. Troubleshooting Docker bridge configuration
          1. Connecting containers to the external world
          2. Reaching containers from the outside world
      3. Configuring DNS
      4. Troubleshooting communication between containers and the external network
        1. Restricting SSH access from one container to another
        2. Linking containers
      5. libnetwork and the Container Network Model
        1. CNM objects
          1. Sandbox
          2. Endpoint
          3. Network
          4. Network controller
          5. CNM attributes
          6. CNM life cycle
      6. Docker networking tools based on overlay and underlay networks
        1. Flannel
        2. Weave
        3. Project Calico
      7. Configuring an overlay network with the Docker Engine swarm node
        1. Comparison of all multi-host Docker networking solutions
      8. Configuring OpenvSwitch (OVS) to work with Docker
        1. Troubleshooting OVS single host setup
        2. Troubleshooting OVS multiple host setups
      9. Summary
    15. 8. Managing Docker Containers with Kubernetes
      1. Deploying Kubernetes on Bare Metal machine
      2. Troubleshooting the Kubernetes Fedora manual setup
      3. Deploying Kubernetes using Minikube
      4. Deploying Kubernetes on AWS
      5. Deploying Kubernetes on vSphere
      6. Kubernetes setup troubleshooting
      7. Kubernetes pod deployment
      8. Deploying Kubernetes in a production environment
      9. Debugging Kubernetes issues
      10. Summary
    16. 9. Hooking Volume Baggage
      1. Avoiding troubleshooting by understanding Docker volumes
      2. Default case storing data inside the Docker container
      3. Data-only container
        1. Creating a data-only container
        2. Sharing data between the host and the Docker container
      4. Host mapped volume backed up by shared storage
        1. Flocker
        2. In the Flocker client node
        3. Convoy Docker volume plugin
      5. Docker storage driver performance
        1. UFS basics
          1. UFS - terminology
          2. UFS - issues
            1. AuFS
            2. Device Mapper
        2. How device-mapper is used by Docker
          1. BTRFS
      6. Summary
    17. 10. Docker Deployment in a Public Cloud - AWS and Azure
      1. Architecture of Amazon ECS
      2. Troubleshooting - AWS ECS deployment
      3. Updating Docker containers in the ECS cluster
      4. Microsoft Azure container service architecture
      5. Troubleshooting - The Microsoft Azure Container Service
      6. Docker Beta for AWS and Azure
      7. Summary

Product information

  • Title: Troubleshooting Docker
  • Author(s): Vaibhav Kohli, Rajdeep Dua, John Wooten
  • Release date: March 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781783552344