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

Beginning DevOps with Docker

Book Description

Automate the deployment of your environment with the power of the Docker toolchain

About This Book
  • Written and reviewed by expert Docker developers
  • The book precisely covers all the essential topics such as building images and managing container swarms required in day to day use for Docker
  • The book includes activities on the docker CLI and exercises such as writing Dockerfiles for Python which will allow you to reinforce the concepts covered
Who This Book Is For

The book is crafted for developers, system architects, junior and mid-level site reliability engineers interested in adapting a docker workflow. They are also required to have a basic knowledge of UNIX concepts such as ssh, ports and logs

What You Will Learn
  • Understand how to effectively design and build containers for different applications
  • Setup an environment for testing, avoiding environment mismatch that is breaking production
  • Setup and manage a multi-tier environment
  • Run, debug, and experiment with applications in a container
In Detail

DevOps with Docker outlines the power of containerization and the influence this innovation has on development teams and general operations. We also get to understand what DevOps really is, the principles involved and how the process contributes to product health, by implementing a Docker workflow. We will learn to interpret Dockerfile syntax, build images and setup containers and images. In addition, we will deploy a Docker image to the Docker Hub.Docker is an open source containerization tool, that makes it easier to streamline product delivery. It helps reduce the time taken to get from a whiteboard sketch of the business to a money-back implementation. This fast-paced book is a perfect amalgamation of theory and hands-on exercises. The book will take you through the basics of Docker and DevOps and why and how they integrate. You will then understand what containers are, and how to create and manage them. Next, we will work on the docker-compose file and CLI. Then we will move to set up a network with the docker-compose tool. Gradually you will learn how to scale a delivery pipeline and multiple deployments with Docker. Lastly, you will grasp the concept of orchestration and learn to implement the delivery of containerized applications.

Style and approach

This is a fast-paced, practical hands-on book aimed at experienced developers and system architects. As you progress you'll find helpful tips and tricks, as well as useful self-assessment material, exercises and activities to help benchmark your progress and reinforce what you've learned. The activities are devised to simulate the real-world conditions in order to equip you with the necessary skills to accelerate software deployment while still retaining security, portability and saving on costs.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased 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.

Table of Contents

  1. Beginning DevOps with Docker
    1. Table of Contents
    2. Beginning DevOps with Docker
      1. Why subscribe?
      2. PacktPub.com
    3. Contributors
      1. About the author
      2. About the reviewer
      3. Packt is searching for authors like you
    4. Preface
      1. Hardware
      2. Software
      3. Who This Book is for
      4. Conventions
      5. Reader Feedback
      6. Customer Support
      7. Downloading the Example Code
      8. Installation
      9. Errata
      10. Piracy
      11. Questions
    5. 1. Images and Containers
      1. Lesson Objectives
      2. Virtualization versus Containerization
      3. How Docker Improves a DevOps Workflow
        1. Recap of the Docker Environment
      4. Basic Docker Terminal Commands
        1. Activity 1 — Utilizing the docker pull Command
        2. Activity 2 — Analyzing the Docker CLI
      5. Dockerfile Syntax
        1. Writing Dockerfiles for Python and JavaScript examples
          1. Python
          2. JavaScript
        2. Activity 3 — Building the Dockerfile
      6. Building Images
        1. docker build
        2. Removing Docker Images
        3. Activity 4 — Utilizing the Docker Image
      7. Running Containers From Images
        1. Python
      8. Versioning Images and Docker Hub
      9. Deploying a Docker Image to Docker Hub
      10. Summary
    6. 2. Application Container Management
      1. Lesson Objectives
      2. The docker-compose Tool
        1. Installing docker-compose
      3. Overview of a Multi-Container Application Setup
        1. The Frontend
        2. The Backend
        3. The Database
        4. Using docker-compose
          1. docker-compose first run
        5. Activity 1 — Running WordPress Using docker-compose
          1. The docker-compose file: docker-compose.yml
          2. The docker-compose CLI
        6. Activity 2 — Analyzing the docker- compose CLI
      4. Managing Multiple Containers and Distributed Application Bundles
        1. Improve a Docker Workflow
          1. The Django Compose File Broken Down
          2. Endure Data Using Volumes
          3. Ports
        2. Activity 3 — Running the docker-compose File
      5. Networking with docker-compose
        1. Run the WordPress Containers
      6. Summary
    7. 3. Orchestration and Delivery
      1. Lesson Objectives
      2. Orchestration
      3. An Overview of Docker Swarm
      4. Using Docker Engine to Create a Swarm
        1. Creating Docker Machines
        2. Listing Created Machines
        3. Worker Machine Creation
        4. Initializing our Swarm
        5. Connecting to a Machine
        6. Initializing Swarm Mode
        7. Adding Workers to our Swarm
        8. Viewing a Cluster's Status
        9. Activity 1 — Adding Nodes to a Cluster
      5. Managing Services and Applications in a Swarm
        1. Creating a Service
        2. Listing Services
        3. Service Status
        4. How Do We Know Our Site is Running?
        5. Activity 2 — Running Services on a Swarm
      6. Scaling Services Up and Down
        1. Scaling Our Database Service
        2. How Does Swarm Know Where to Schedule a Service?
        3. How Does Swarm Load Balance Requests between Replicas?
        4. Activity 3 — Scaling Services on a Swarm
      7. Summary
    8. Index