Docker Containers: Build and Deploy with Kubernetes, Flannel, Cockpit, and Atomic

Book description

The Practical Guide to Running Docker on Linux Systems or Cloud Environments

Whether on your laptop or a remote cloud, Docker can transform how you create, test, deploy, and manage your most critical applications. In Docker Containers, Christopher Negus helps you master Docker containerization from the ground up.

You’ll start out running a few Docker container images in Ubuntu, Fedora, RHEL, CoreOS, or Project Atomic. By the time you’ve finished, you’ll be deploying enterprise-quality, multi-container Kubernetes setups in modern Linux and cloud environments.

Writing for system administrators, software developers, and technology enthusiasts, Negus touches on every aspect of working with Docker: setting up containerized applications, working with both individual and multiple containers, running containers in cloud environments, and developing containers.

Teaching through realistic examples of desktop applications, system services, and games, Negus guides you through building and deploying your own Dockerized applications. As you build your expertise, you’ll also learn indispensable Docker best practices for building and integrating containers, managing Docker on a day-to-day basis, and much more:

• Understanding what Docker is and what you can do with it

• Installing Docker on standard Linux or specialized container operating systems such as Atomic Host and CoreOS

• Setting up a container runtime environment and private Docker Registry

• Creating, running, and investigating Docker images and containers

• Finding, pulling, saving, loading, and tagging container images

• Pulling and pushing containers between local systems and Docker Registries

• Integrating Docker containers with host networking and storage

• Building containers with the docker build command and Dockerfile files

• Minimizing space consumption and erasing unneeded containers

• Accessing special host privileges from within a container

• Orchestrating multiple containers into complex applications with Kubernetes

• Using super privileged containers in cloud environments

• Managing containers in the cloud with Cockpit

• Getting started with Docker container development

• Learning container build techniques from shared Dockerfiles

This book is part of the Pearson Content Update Program. As the technology changes, sections of this book will be updated or new sections will be added. The updates will be delivered to you via a free Web Edition of this book, which can be accessed with any Internet connection.

Table of contents

  1. Cover Page
  2. About This E-Book
  3. Title Page
  4. Copyright Page
  5. Dedication Page
  6. Contents
  7. Preface
    1. Knowledge to Help You with Docker
    2. What This Book Covers
      1. Part I: Getting Going with Containers
      2. Part II: Working with Individual Containers
      3. Part III: Running Containers in Cloud Environments
      4. Part IV: Managing Multiple Containers
      5. Part V: Developing Containers
  8. Acknowledgments
  9. About the Author
  10. Part I: Getting Going with Containers
    1. Chapter 1. Containerizing Applications with Docker
      1. Understanding Pros and Cons of Containerizing Applications
        1. ...An Application Running Directly on a Host Computer
        2. ...An Application Running Directly within a Virtual Machine
        3. Understanding the Upside of Containers
        4. Understanding Challenges of Containerizing Applications
      2. Understanding What Makes Up Docker
        1. The Docker Project
        2. The Docker Hub Registry
        3. Docker Images and Containers
        4. The docker Command
      3. Approaching Containers
      4. Summary
    2. Chapter 2. Setting Up a Container Run-Time Environment
      1. Configuring a Standard Linux System for Docker
        1. Configuring Ubuntu for Docker
        2. Configuring Fedora for Docker
        3. Configuring Red Hat Enterprise Linux for Docker
        4. Configuring Other Operating Systems for Docker
      2. Configuring a Container-Style Linux System for Docker
        1. Configuring an Atomic Host for Docker
        2. Configuring CoreOS for Docker
      3. Summary
    3. Chapter 3. Setting Up a Private Docker Registry
      1. Getting and Starting a Private Docker Registry
        1. Setting Up a Docker Registry in Fedora
        2. Setting Up a Docker Registry in Ubuntu
      2. Configuring a Private Docker Registry
        1. Configuring the docker-registry Package
        2. Configuring the registry Container
      3. Understanding the Docker Image Namespace
      4. Summary
  11. Part II: Working with Individual Containers
    1. Chapter 4. Running Container Images
      1. Running Container Images Interactively
        1. Starting an Interactive Bash Shell
        2. Playing Some Character-Based Games
        3. Running Administrative Commands Inside a Container
      2. Running Containerized Services
        1. Running a Containerized Web Server
        2. Limiting Resources When Running Services in Containers
      3. Running Privileged Containers
      4. Summary
    2. Chapter 5. Finding, Pulling, Saving, and Loading Container Images
      1. Searching for Images
        1. Searching for Images with the docker Command
        2. Searching for Images on Docker Hub
        3. Searching Other Repositories for Images
      2. Pulling Images from Registries
      3. Saving and Loading Images
      4. Summary
    3. Chapter 6. Tagging Images
      1. Assigning Names to Images
      2. Assigning Tags to Images
      3. Assigning Repository Names to Images
        1. Attaching a User Name to an Image
        2. Attaching a Repository Name to an Image
      4. Summary
    4. Chapter 7. Investigating Containers
      1. Inspecting Images and Containers
      2. Inspecting an Image
        1. Inspecting Base Images with docker inspect
        2. Inspecting Application Images with docker inspect
        3. Looking at the History of an Image
      3. Inspecting Running Containers
        1. Start a Container to Inspect
        2. Inspect an Entire Container Configuration
        3. Inspect Individual Container Attributes
      4. Finding More Ways to Look into Containers
        1. Using docker top to See Container Processes
        2. Using docker attach to Interact with a Service Inside a Container
        3. Using docker exec to Start a New Process in a Running Container
        4. Using docker logs to See Container Process Output
        5. Using docker diff to See How a Container Has Changed
        6. Using docker cp to Copy Files from a Container
      5. Summary
    5. Chapter 8. Starting, Stopping, and Restarting Containers
      1. Stopping and Starting a Container
        1. Stopping and Starting a Detached Container
        2. Starting and Stopping an Interactive Container
      2. Restarting a Container
      3. Sending Signals to a Container
      4. Pausing and Unpausing Containers
      5. Waiting for a Container’s Exit Code
      6. Renaming a Container
      7. Creating a Container
      8. Summary
    6. Chapter 9. Configuring Container Storage
      1. Managing Storage for a Container
        1. Using Volumes from the Host
        2. Data Volume Container
        3. Write-Protecting a Bind Mount
        4. Mounting Devices
        5. Mounting Sockets
      2. Storage Strategies for the Docker Host
        1. Attaching External Storage to a Docker Host
      3. Summary
    7. Chapter 10. Configuring Container Networking
      1. Expose Ports to Other Containers
      2. Map Ports Outside the Host
        1. Map a Port from Linked Containers
        2. Connect Containers on Different Hosts
      3. Alternatives to the docker0 Bridge
        1. Changing Network Mode for a Container
        2. Examining Network Options
      4. Changing the Docker Network Bridge
      5. Summary
    8. Chapter 11. Cleaning Up Containers
      1. Making Space for Images and Containers
      2. Removing Images
        1. Removing Individual Images
        2. Removing Multiple Images
      3. Removing Containers
        1. Removing Individual Containers
        2. Removing Multiple Containers
      4. Cleaning Up and Saving Containers
        1. Cleaning Up and Saving an Ubuntu Container
        2. Cleaning Up and Saving a Fedora Container
      5. Summary
    9. Chapter 12. Building Docker Images
      1. Doing a Simple docker build
      2. Setting a Command to Execute from a Dockerfile
        1. Using the CMD Instruction
        2. Using the ENTRYPOINT Instruction
        3. Using the RUN Instruction
        4. Adding Files to an Image from a Dockerfile
      3. Exposing Ports from an Image within a Dockerfile
      4. Assigning Environment Variables in a Dockerfile
      5. Assigning Labels in a Dockerfile
      6. Using Other docker build Command Options
      7. Tips for Building Containers
        1. Clean Up the Image
        2. Keep Build Directory Small
        3. Keep Containers Simple
        4. Manage How Caching Is Done
      8. Summary
  12. Part III: Running Containers in Cloud Environments
    1. Chapter 13. Using Super Privileged Containers
      1. Using Super Privileged Containers in Atomic Host
      2. Understanding Super Privileged Containers
        1. Opening Privileges to the Host
        2. Accessing the Host Process Table
        3. Accessing Host Network Interfaces
        4. Accessing Host Inter-Process Communications
        5. Accessing Host File Systems
      3. Preparing to Use Super Privileged Containers
      4. Using the atomic Command
        1. Installing an SPC Image with atomic
        2. Getting Information about an SPC Image with atomic
        3. Running an SPC Image with atomic
        4. Stopping and Restarting an SPC with atomic
        5. Updating an SPC Image
        6. Uninstalling an SPC Image
      5. Trying Some SPCs
        1. Running the RHEL Tools SPC
        2. Running the Logging (rsyslog) SPC
        3. Running the System Monitor (sadc) SPC
      6. Summary
    2. Chapter 14. Managing Containers in the Cloud with Cockpit
      1. Understanding Cockpit
      2. Starting with Cockpit
      3. Adding Servers into Cockpit
      4. Working with Containers from Cockpit
        1. Adding Container Images to Cockpit
        2. Running Images from Cockpit
      5. Working with Network Interfaces from Cockpit
      6. Configuring Storage from Cockpit
      7. Doing Other Administrative Tasks in Cockpit
        1. Managing Administrator Accounts in Cockpit
        2. Open a Terminal in Cockpit
      8. Summary
  13. Part IV: Managing Multiple Containers
    1. Chapter 15. Orchestrating Containers with Kubernetes
      1. Understanding Kubernetes
      2. Starting with Kubernetes
      3. Setting Up an All-in-One Kubernetes Configuration
        1. Installing and Starting Up Kubernetes
        2. Starting Up a Pod in Kubernetes
        3. Working with Kubernetes
      4. Summary
    2. Chapter 16. Creating a Kubernetes Cluster
      1. Understanding Advanced Kubernetes Features
      2. Setting Up a Kubernetes Cluster
        1. Step 1: Install Linux
        2. Step 2: Set Up Kubernetes Master
        3. Step 3: Set Up Kubernetes Nodes
        4. Step 4: Set Up Networking with Flannel
      3. Starting Up Pods in a Kubernetes Cluster
      4. Deleting Replication Controllers, Services, and Pods
      5. Summary
  14. Part V: Developing Containers
    1. Chapter 17. Developing Docker Containers
      1. Setting Up for Container Development
        1. Choosing a Container Development Environment for Red Hat Systems
        2. Container Development Environments from Docker
      2. Using Good Development Practices
        1. Gathering or Excluding Files for a Build
        2. Taking Advantage of Layers
        3. Managing Software Packages in a Build
        4. Learning More about Building Containers
      3. Summary
    2. Chapter 18. Exploring Sample Dockerfile Files
      1. Examining Dockerfiles for Official Docker Images
        1. Viewing a CentOS Dockerfile
        2. Viewing a Busybox Dockerfile
      2. Examining Dockerfiles from Open Source Projects
        1. Viewing a WordPress Dockerfile
        2. Viewing the MySQL Dockerfile
      3. Examining Dockerfiles for Desktop and Personal Use
        1. Viewing a Chrome Dockerfile
        2. Viewing a Firefox Dockerfile
      4. Summary
  15. Index
  16. Inside Front Cover
  17. Inside Back Cover
  18. Code Snippets

Product information

  • Title: Docker Containers: Build and Deploy with Kubernetes, Flannel, Cockpit, and Atomic
  • Author(s): Christopher Negus
  • Release date: December 2015
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780134136639