Mastering Docker - Third Edition

Book description

Master Docker and leverage its power in your day-to-day workflow

Key Features

  • Explore tools such as Docker Engine, Machine, Compose, and Swarm
  • Discover how Docker can be integrated into your daily workflows
  • Learn to leverage Docker Swarm and Kubernetes

Book Description

Docker has been a game-changer when it comes to how modern applications are deployed and created. It has now grown into a key driver of innovation beyond system administration, with an impact on the world of web development. But how can you make sure you're keeping up with the innovations it's driving, or be sure you're using it to its full potential? Mastering Docker shows you how; this book not only demonstrates how to use Docker more effectively, but also helps you rethink and reimagine what's possible with it.

You will cover concepts such as building, managing, and storing images, along with best practices to make you confident, before delving more into Docker security. You'll find everything related to extending and integrating Docker in new and innovative ways. Docker Compose, Docker Swarm, and Kubernetes will help you take control of your containers in an efficient manner.

By the end of the book, you will have a broad, yet detailed, sense of what's possible with Docker, and how seamlessly it fits in with a range of other platforms and tools.

What you will learn

  • Become ?uent with the basic components and concepts of Docker
  • Learn the best ways to build, store, and distribute containers
  • Understand how Docker can fit into your development work?ow
  • Secure your containers and files with Docker's security features
  • Solve architectural problems using the first and third clustering tool
  • Leverage Linux containers and create highly scalable applications

Who this book is for

If you are an I.T professional and recognize Docker's importance for innovation in everything from system administration to web development, but aren't sure how to use it to its full potential, Mastering Docker is for you.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Mastering Docker Third Edition
  3. Packt Upsell
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Code in Action
      4. Conventions used
    4. Get in touch
      1. Reviews
  6. Docker Overview
    1. Technical requirements
    2. Understanding Docker
      1. Developers
        1. The problem
        2. The Docker solution
      2. Operators
        1. The problem
        2. The Docker solution
      3. Enterprise
        1. The problem
        2. The Docker solution
    3. The differences between dedicated hosts, virtual machines, and Docker
    4. Docker installation
      1. Installing Docker on Linux (Ubuntu 18.04)
      2. Installing Docker on macOS
      3. Installing Docker on Windows 10 Professional
      4. Older operating systems
    5. The Docker command-line client
    6. Docker and the container ecosystem
      1. Open source projects
      2. Docker CE and Docker EE
      3. Docker, Inc.
    7. Summary
    8. Questions
    9. Further reading
  7. Building Container Images
    1. Technical requirements
    2. Introducing the Dockerfile
      1. Reviewing the Dockerfile in depth
        1. FROM
        2. LABEL
        3. RUN
        4. COPY and ADD
        5. EXPOSE
        6. ENTRYPOINT and CMD
        7. Other Dockerfile instructions
          1. USER
          2. WORKDIR
          3. ONBUILD
          4. ENV
      2. Dockerfiles – best practices
    3. Building container images
      1. Using a Dockerfile to build a container image
      2. Using an existing container
      3. Building a container image from scratch
      4. Using environmental variables
      5. Using multi-stage builds
    4. Summary
    5. Questions
    6. Further reading
  8. Storing and Distributing Images
    1. Technical requirements
    2. Docker Hub
      1. Dashboard
      2. Explore
      3. Organizations
      4. Create
      5. Profile and settings
      6. Other menu options
      7. Creating an automated build
        1. Setting up your code
        2. Setting up Docker Hub
      8. Pushing your own image
    3. Docker Store
    4. Docker Registry
      1. An overview of Docker Registry
      2. Deploying your own registry
    5. Docker Trusted Registry
    6. Third-party registries
    7. Microbadger
    8. Summary
    9. Questions
    10. Further reading
  9. Managing Containers
    1. Technical requirements
    2. Docker container commands
      1. The basics
      2. Interacting with your containers
        1. attach
        2. exec
      3. Logs and process information
        1. logs
        2. top
        3. stats
      4. Resource limits
      5. Container states and miscellaneous commands
        1. Pause and unpause
        2. Stop, start, restart, and kill
        3. Removing containers
        4. Miscellaneous commands
    3. Docker networking and volumes
      1. Docker networking
      2. Docker volumes
    4. Summary
    5. Questions
    6. Further reading
  10. Docker Compose
    1. Technical requirements
    2. Introducing Docker Compose
    3. Our first Docker Compose application
    4. Docker Compose YAML file
      1. Moby counter application
      2. Example voting application
    5. Docker Compose commands
      1. Up and PS
      2. Config
      3. Pull, build, and create
      4. Start, stop, restart, pause, and unpause
      5. Top, logs, and events
      6. Scale
      7. Kill, rm, and down
    6. Docker App
    7. Summary
    8. Questions
    9. Further reading
  11. Windows Containers
    1. Technical requirements
    2. An introduction to Windows containers
    3. Setting up your Docker host for Windows containers
      1. Windows 10 Professional
      2. macOS and Linux
    4. Running Windows containers
    5. A Windows container Dockerfile
    6. Windows containers and Docker Compose
    7. Summary
    8. Questions
    9. Further reading
  12. Docker Machine
    1. Technical requirements
    2. An introduction to Docker Machine
    3. Deploying local Docker hosts with Docker Machine
    4. Launching Docker hosts in the cloud
    5. Using other base operating systems
    6. Summary
    7. Questions
    8. Further reading
  13. Docker Swarm
    1. Technical requirements
    2. Introducing Docker Swarm
    3. Roles within a Docker Swarm cluster
      1. Swarm manager
      2. Swarm worker
    4. Creating and managing a Swarm
      1. Creating a cluster
      2. Adding a Swarm manager to the cluster
      3. Joining Swarm workers to the cluster
      4. Listing nodes
    5. Managing a cluster
      1. Finding information on the cluster
      2. Promoting a worker node
      3. Demoting a manager node
      4. Draining a node
    6. Docker Swarm services and stacks
      1. Services
      2. Stacks
    7. Deleting a Swarm cluster
    8. Load balancing, overlays, and scheduling
      1. Ingress load balancing
      2. Network overlays
      3. Scheduling
    9. Summary
    10. Questions
    11. Further reading
  14. Docker and Kubernetes
    1. Technical requirements
    2. An introduction to Kubernetes
      1. A brief history of containers at Google
      2. An overview of Kubernetes
      3. Kubernetes and Docker
    3. Enabling Kubernetes
    4. Using Kubernetes
    5. Kubernetes and other Docker tools
    6. Summary
    7. Questions
    8. Further reading
  15. Running Docker in Public Clouds
    1. Technical requirements
    2. Docker Cloud
    3. Docker on-cloud
      1. Docker Community Edition for AWS
      2. Docker Community Edition for Azure
      3. Docker for Cloud summary
    4. Amazon ECS and AWS Fargate
    5. Microsoft Azure App Services
    6. Kubernetes in Microsoft Azure, Google Cloud, and Amazon Web Services
      1. Azure Kubernetes Service
      2. Google Kubernetes Engine
      3. Amazon Elastic Container Service for Kubernetes
      4. Kubernetes summary
    7. Summary
    8. Questions
    9. Further reading
  16. Portainer - A GUI for Docker
    1. Technical requirements
    2. The road to Portainer
    3. Getting Portainer up and running
    4. Using Portainer
      1. The Dashboard
      2. Application templates
      3. Containers
        1. Stats
        2. Logs
        3. Console
      4. Images
      5. Networks and volumes
        1. Networks
        2. Volumes
      6. Events
      7. Engine
    5. Portainer and Docker Swarm
      1. Creating the Swarm
      2. The Portainer service
      3. Swarm differences
        1. Endpoints
        2. Dashboard and Swarm
        3. Stacks
        4. Services
        5. Adding endpoints
    6. Summary
    7. Questions
    8. Further reading
  17. Docker Security
    1. Technical requirements
    2. Container considerations
      1. The advantages
      2. Your Docker host
      3. Image trust
    3. Docker commands
      1. run command
      2. diff command
    4. Best practices
      1. Docker best practices
      2. The Center for Internet Security benchmark
        1. Host configuration
        2. Docker daemon configuration
        3. Docker daemon configuration files
        4. Container images/runtime and build files
        5. Container runtime
        6. Docker security operations
    5. The Docker Bench Security application
      1. Running the tool on Docker for macOS and Docker for Windows
      2. Running on Ubuntu Linux
      3. Understanding the output
        1. Host configuration
        2. Docker daemon configuration
        3. Docker daemon configuration files
        4. Container images and build files
        5. Container runtime
        6. Docker security operations
        7. Docker Swarm configuration
      4. Summing up Docker Bench
    6. Third-party security services
      1. Quay
      2. Clair
      3. Anchore
    7. Summary
    8. Questions
    9. Further reading
  18. Docker Workflows
    1. Technical requirements
    2. Docker for development
    3. Monitoring
    4. Extending to external platforms
      1. Heroku
    5. What does production look like?
      1. Docker hosts
        1. Mixing of processes
        2. Multiple isolated Docker hosts
        3. Routing to your containers
      2. Clustering
        1. Compatibility
        2. Reference architectures
        3. Cluster communication
      3. Image registries
    6. Summary
    7. Questions
    8. Further reading
  19. Next Steps with Docker
    1. The Moby Project
    2. Contributing to Docker
      1. Contributing to the code
      2. Offering Docker support
      3. Other contributions
    3. The Cloud Native Computing Foundation
      1. Graduated projects
      2. Incubating projects
      3. The CNCF landscape
    4. Summary
  20. Assessments
    1. Chapter 1, Docker Overview
    2. Chapter 2, Building Container Images
    3. Chapter 3, Storing and Distributing Images
    4. Chapter 4, Managing Containers
    5. Chapter 5, Docker Compose
    6. Chapter 6, Windows Containers
    7. Chapter 7, Docker Machine
    8. Chapter 8, Docker Swarm
    9. Chapter 9, Docker and Kubernetes
    10. Chapter 10, Running Docker in Public Clouds
    11. Chapter 11, Portainer - A GUI for Docker
    12. Chapter 12, Docker Security
    13. Chapter 13, Docker Workflows
  21. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Mastering Docker - Third Edition
  • Author(s): Russ McKendrick, Scott Gallagher
  • Release date: October 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781789616606