This morning, I selected an article about Docker. I feel it is necessary to recommend this book to you. Docker in Plain English, no. 1 on BookAuthority’s list of the best Docker books, why not?

 

Docker has an 8.0 rating on Douban.

 

To quote douban:

For me this pure white, this book is undoubtedly my technical mentor, from shallow to deep, step by step! For example, I can configure accelerated mirroring, which is not mentioned in this book. I also used VirtualBox and Docker Machine to create a local multi-virtual machine environment when configuring swarm cluster. When I configured ucP client to connect docker Daemon, I used the local node as the server and docker Machine virtual machine as the client, etc. Even though the author made it very clear, there was still a lot of trouble if I really started. There are several obvious mistakes in the book, but fortunately it is not difficult to guess what the correct one is. In terms of translation quality alone, it is absolutely great! Read smoothly and without stress! It was a little difficult for me to learn Docker EE due to my weakness in the network, but FORTUNATELY I persevered. Thanks again for such a book that introduced me to the path of Docker and made me have a happy learning time. Learning makes me confident and enriched. (put)

What is the Docker

To understand what a Docker is, it’s easier to start with a metaphor than a technical explanation, and the Docker metaphor is very convincing. A Docker was originally a worker who moved goods in and out of a ship after it docked at a port. Boxes and items come in a variety of sizes and shapes, and experienced dockworkers are favored for their ability to manually load goods into ships in an economical manner (see Figure 1-2). Hiring someone to carry things isn’t cheap, but there’s no alternative.

This should sound familiar to anyone who works in the software industry. A great deal of time and effort is spent putting odd-shaped software onto boats of various sizes filled with other odd-shaped software so that it can be sold to users or businesses elsewhere.

Figure 1-3 shows how you can save time and money when using the Docker concept.

 

Figure 1-2 Shipping comparison of standardized containers before and after

Before Docker, the amount of work required to deploy software to different environments was enormous. Even if software is not deployed on different machines by manually running scripts (and there are plenty of people who do), users have to grapple with configuration management tools that manage the state of a resource-hungry and fast-changing environment. Even if this work is encapsulated in virtual machines, it still takes a lot of time to deploy these virtual machines, wait for them to start up, and manage the additional resource overhead they generate.

With Docker, configuration is separated from resource management, and deployment is trivial: Run Docker Run, and the environment’s image is pulled down and ready to run, consuming fewer resources and being embedded, so it doesn’t interfere with other environments.

Readers do not need to worry about whether containers will be distributed to Red Hat machines, Ubuntu machines, or CentOS virtual machine images, as long as Docker is on them, there is no problem.

 

Figure 1-3 Comparison of software delivery before and after Using Docker

What’s good about Docker

Several important practical questions arise: why Docker is used, and for what? The short answer to the “why” question is: With a little effort, Docker can quickly save companies a lot of money. Some of these methods (certainly not all of them) will be discussed in subsequent sections. We already see all of these benefits in the real world.

1. Alternative Virtual Machines (VMS)

Docker can replace virtual machines in many cases. If users only care about the application, not the operating system, they can replace the virtual machine with Docker and leave the operating system to someone else to worry about. Docker not only starts faster than a virtual machine, it migrates lighter, and thanks to its tiered file system, it’s easier and faster to share changes with others. Moreover, it is firmly rooted in the command line, making it ideal for scripting.

2. Software prototype

If you want to experience the software quickly, while avoiding the hassle of interfering with your current setup or setting up a virtual machine, Docker can provide a sandbox environment in milliseconds. It’s hard to feel the liberating effects until you experience them yourself.

3. Packaged software

Because Docker images have virtually no dependencies for Linux users, they are ideal for packaging software. Users can build the image and ensure that it runs on any modern Linux machine — just like Java, but without the NEED for a JVM.

4. Make microservices architecture possible

Docker helps decompose a complex system into a series of composable parts, which allows users to think about their services in a more discrete way. Users can reorganize software to make its parts more manageable and pluggable without affecting the overall picture.

5. Network modeling

Because hundreds (or even thousands) of isolated containers can be started on a single machine, modeling a network is easy. This is very useful for testing real-world scenarios at a fraction of the cost.

6. Enable full stack productivity when offline

Because all parts of the system can be bundled into a Docker container, users can program it to run on their laptop for mobile work, even when offline.

7. Lower debugging expenses

Complex negotiations between different teams over software delivery are common in the industry. We have experienced countless discussions of failed libraries, problematic dependencies, updates that are incorrectly implemented or executed in the wrong order, or perhaps not executed at all, and errors that cannot be reproduced. Readers may have encountered it too. Docker allows users to clearly explain (even in script form) the steps to debug a problem on a system with known properties, making error and environment recurrence easier and often separate from the provided host environment.

8. Document software dependencies and touchpoints

By building images in a structured way to prepare for migration to different environments, Docker forces users to explicitly document software dependencies from a basic starting point. Even if users don’t plan to use Docker everywhere, this need for documentation helps install software elsewhere.

9. Enable continuous delivery

Continuous Delivery (CD) is a software delivery paradigm based on an automated (or semi-automated) process that rebuilds the system at each change and delivers it to the production environment.

Because users can more accurately control the state of the build environment, Docker builds are more reproducible and replicable than traditional software build methods. Make it easier to implement continuous delivery. By implementing a Docker-centric reproducible build process, standard continuous delivery techniques such as Blue/Green Deployment (which maintains “production” and “latest” deployments in a production environment) and Phoenix Deployment, Rebuild the entire system with each release) becomes simple.

Readers now have a sense of how Docker can help. Before we dive into a real-world example, let’s look at a few core concepts.

Why read this book? Why pay attention to Docker

Docker is everywhere these days, it’s a fact of life. Developers love it, and operations engineers need it. They all need an in-depth understanding of how to build and maintain production-level containerized applications in business-critical environments, and this book will help readers master it.

 

Is Docker only for developers

For those of you who think Docker is a developer tool, get ready to change your mind.

Containerized applications need a place to run and someone to manage them. It would be a mistake to assume that only developers manage it, as operations requires building and running a high-performance, production-level Docker infrastructure. For those of you who are focused on operations but have not yet mastered Docker, life may not be easy. But don’t worry, this book will help you master Docker.

inventory

Part 1 Overview of Docker Chapter 1 The Road to Container Development 2 1.1 Backward Old Times 2 1.2 Hello VMware! 2 1.3 Virtual machine shortage 3 1.4 Hello, container! 3 1.5 Linux containers 3 1.6 Hello Docker! 4 1.7 Windows Container 4 1.8 Windows container vs Linux container 4 1.9 Mac container status 5 1.10 Kubernetes5 1.11 This chapter summary 6 chapter 2 into Docker7 2.1 Docker – Introduction 7 2.2 Docker Company 7 2.3 Docker Runtime Choreography Engine 8 2.4 Docker Open Source Project (Moby) 9 2.5 Container Ecology 10 2.6 Open Container Project 11 2.7 Chapter Summary 12 Chapter 3Docker Installation 13 3.1 Windows Docker (DfW) 13 3.2 Mac Docker (DfM) 17 3.3 Installing Docker19 on Linux 3.4 Installing Docker21 on Windows Server 2016 3.5 Docker Engine Upgrade 22 3.5.1 Upgrading the Docker CE23 on Ubuntu 16.04 3.5.2 Upgrading the Docker EE24 on Windows Server 2016 3.6 Selecting a Docker Storage Driver 25 3.6.1 Device Mapper configuration 26 3.6.2 Letting Docker Automatically Configure Direct-LVM26 3.6.3 Manually Configuring Direct-LVM28 of Device Mapper 4.1 Operation view 29 4.1.1 Image 30 4.1.2 Containers 31 4.1.3 Connecting to containers in operation 34 4.2 Development View 35 4.3 Chapter Summary 38 Part II Docker Technology Chapter 5 Docker Engine 40 5.1 Docker engine — Introduction 40 5.2 Docker engine — Detail 41 5.2.1 Get rid of LXC41 5.2.2 Get rid of large and complete Docker daemon42 5.2.3 Impact of the Open Container Initiative (OCI) 43 5.2.4 RUNc43 5.2.5 Containerd43 5.2.6 Starting a new container (example) 44 5.2.7 Significant advantages of this model 45 5.2.8 SHIM45 5.2.9 Implementation on Linux 46 5.2.10 Functions of Daemons 46 5.3 Chapter Summary 46 Chapter 6 Docker Images 48 6.1 Docker Images – Introduction 48 6.2 Docker Images – Details 48 6.2.1 Images and Containers 49 6.2.2 Images are Usually small 49 6.2.3 Pulling an image 49 6.2.4 Image naming 51 6.2.5 Image repository service 51 6.2.6 Image naming and labeling 52 6.2.7 Labeling an image 54 6.2.8 Filtering a Docker Image Ls 55 6.2.9 Searching for a Docker Hub56 6.2.10 Mirroring and Layering 57 6.2.11 Shared Mirroring layer 60 6.2.12 Pulling mirrors based on summaries 61 6.2.13 Image hash value (Summaries) 63 6.2.14 Multi-Layer Image 63 6.2.15 Deleting an Image 65 6.3 Image – Command 67 6.4 Summary 67 Chapter 7 Docker Containers 68 7.1 Docker Containers – Introduction 68 7.2 Docker Containers – Details 69 7.2.1 Containers vs virtual Machines 69 7.2.2 Extra overhead of virtual machines 71 7.2.3 Running containers 71 7.2.4 Checking Docker daemon71 7.2.5 Starting a simple container 72 7.2.6 Container processes 74 7.2.7 Container life cycle 75 7.2.8 Gracefully stopping the container 78 7.2.9 Self-healing the container using a restart policy 78 7.2.10 Web server example 80 7.2.11 Viewing container details 82 7.2.12 Quick Cleanup 82 7.3 Containerization – Command 83 7.4 Chapter conclusion 84 Chapter 8 Containerization of Applications 85 8.1 Containerization of Applications – Introduction 85 8.2 Containerization of Applications – Details 86 8.2.1 Containerization of Single Applications 86 8.2.2 Multi-stage Construction in the Production Environment 95 8.2.3 Best Practices 98 8.3 Application Containerization — Command 100 8.4 Chapter Summary 101 Chapter 9 Deploying An Application with Docker Compose 102 9.1 Deploying an Application with Docker Compose — Introduction 102 9.2 Using Docker Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Compose Deployment 107 9.2.5 Docker Compose Management 110 9.3 Docker Compose Deployment – Command 115 9.4 Chapter 10 Docker Swarm117 Docker Swarm – Docker Swarm – Docker Swarm – Docker Swarm – Docker Swarm – Docker Swarm 10.2.4 Troubleshooting 133 10.3 Docker Swarm – Command 134 10.4 Chapter 135 Chapter 11 Docker network 136 11.1 Docker network – Introduction 136 11.2 Docker network – Details 137 11.2.1 Basic Theory 137 11.2.2 Single-machine Bridge network 140 11.2.3 Multi-machine Coverage network 146 11.2.4 Access to existing network 146 11.2.5 Service discovery 152 11.2.6 Ingress network 153 11.3 Docker Network – Command 156 11.4 Chapter 12 Docker Overwrite network 157 12.1 Docker Overwrite Network – Introduction 157 12.2 Docker Overwrite network – Details 157 Docker overwrite network — Command 168 12.4 Chapter summary 168 Chapter 13 Volume and Persistent Data 169 13.1 Volumes and Persistent Data – Introduction 169 13.2 Volumes and Persistent Data – Details 169 13.2.1 Containers and Non-Persistent Data 170 13.2.2 Containers and Persistent Data 170 13.2.3 Sharing Storage between Cluster Nodes 175 13.3 Volumes and Persistent Data – Command 176 13.4 Chapter 14 Deploying Applications using the Docker Stack 177 14.1 Deploying Applications using the Docker Stack – Introduction 177 14.2 Using the Docker Deploying applications using the Docker Stack – Detailed 178 14.2.1 Simple Applications 178 14.2.2 Analyzing Stack Files 180 14.2.3 Deploying applications 186 14.2.4 Managing Applications 191 14.3 Deploying Applications using the Docker Stack – Command 193 Chapter 15 Docker Security 195 15.1 Docker Security – Introduction 195 15.2 Docker Security – Detailed 196 15.2.1 Linux Security Technology 197 15.2.2 Docker Platform Security Technology 201 15.3 Overview 212 Chapter 16 Enterprise Tools 213 16.1 Enterprise Tools – Introduction 213 16.2 Enterprise Tools – Details 214 16.2.1 Docker EE Engine 214 16.2.2 Docker General Control Plane (UCP) 216 16.2.3 Docker Trusted Image Warehouse Service (DTR) 227 16.3 Chapter 17 Enterprise-level Features 234 17.1 Enterprise-level Features – Introduction 234 17.2 Enterprise-level Features – Details 234 17.2.1 Role-based Permission Control (RBAC) 235 17.2.2 Integrating active Directory 239 17.2.3 Docker Content Trust Mechanism (DCT) 241 17.2.4 Configuring the Docker Trusted Image Repository Service (DTR) 243 17.2.5 Using the Docker Trusted Mirror Warehouse Service 244 17.2.6 Promoting images 247 17.2.7 HTTP Routing Grid (HRM) 250 17.3 Chapter summary 253 Appendix A Communication between secure Clients and Daemons 255 Appendix BDCA Exam 265 Appendix C extends 270