O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Docker Containers: From Start to Enterprise

Book Description

This is the Rough Cut version of the printed book

Start out running a few Docker container images in Ubuntu, Fedora, RHEL, CoreOS or Project Atomic. End up deploying enterprise-quality, multi-container Kubernetes setups in a Linux or cloud environment. In between, learn best practices for building containers from Dockerfile files, integrating them with host storage and networking, and accessing special host privileges. 

Whether you are a system administrator, software developer or just an enthusiast, Docker Containers: From Start to Enterprise  launches you into the latest Docker container technology. Examine fun and useful real-world Docker container examples and learn how to leverage them to build your own Dockerized applications.

With Docker Containers: From Start to Enterprise you will be able to: install Docker on standard Linux or specialized container operating systems; set up a private Docker Registry; create, run and investigate Docker images and containers; pull and push containers between local systems and Docker Registries; integrate Docker containers with host networking and storage. orchestrate multiple containers into complex applications with Kubernetes; and employ best practices when developing containerized applications.

Table of Contents

  1. About This E-Book
  2. Title Page
  3. Copyright Page
  4. Dedication Page
  5. Contents
  6. 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
  7. Acknowledgments
  8. About the Author
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. Index
  15. Code Snippets