Preface |
|
xvii | |
Acknowledgments |
|
xviii | |
About This Book |
|
xix | |
About The Author |
|
xxiii | |
|
PART 1 UNDERSTANDING DOCKER CONTAINERS AND IMAGES |
|
|
1 | (94) |
|
|
3 | (12) |
|
1.1 Why containers will take over the world |
|
|
4 | (6) |
|
Migrating apps to the cloud |
|
|
4 | (2) |
|
|
6 | (1) |
|
Building new cloud-native apps |
|
|
6 | (2) |
|
Technical innovation: Serverless and more |
|
|
8 | (2) |
|
Digital transformation with DevOps |
|
|
10 | (1) |
|
1.2 Is this book for you? |
|
|
10 | (1) |
|
1.3 Creating your lab environment |
|
|
11 | (3) |
|
|
11 | (1) |
|
Verifying your Docker setup |
|
|
12 | (1) |
|
Downloading the source code for the book |
|
|
13 | (1) |
|
Remembering the cleanup commands |
|
|
13 | (1) |
|
1.4 Being immediately effective |
|
|
14 | (1) |
|
2 Understanding Docker and running Hello World |
|
|
15 | (16) |
|
2.1 Running Hello World in a container |
|
|
15 | (3) |
|
2.2 So what is a container? |
|
|
18 | (2) |
|
2.3 Connecting to a container like a remote computer |
|
|
20 | (3) |
|
2.4 Hosting a website in a container |
|
|
23 | (4) |
|
2.5 Understanding how Docker runs containers |
|
|
27 | (2) |
|
2.6 Lab: Exploring the container filesystem |
|
|
29 | (2) |
|
3 Building your own Docker images |
|
|
31 | (14) |
|
3.1 Using a container image from Docker Hub |
|
|
31 | (4) |
|
3.2 Writing your first Dockerfile |
|
|
35 | (2) |
|
3.3 Building your own container image |
|
|
37 | (2) |
|
3.4 Understanding Docker images and image layers |
|
|
39 | (3) |
|
3.5 Optimizing Dockerfiles to use the image layer cache |
|
|
42 | (2) |
|
|
44 | (1) |
|
4 Packaging applications from source code into Docker Images |
|
|
45 | (16) |
|
4.1 Who needs a build server when you have a Dockerfile? |
|
|
45 | (4) |
|
4.2 App walkthrough: Java source code |
|
|
49 | (4) |
|
4.3 App walkthrough: Node.js source code |
|
|
53 | (3) |
|
4.4 App walkthrough: Go source code |
|
|
56 | (3) |
|
4.5 Understanding multi-stage Dockerfiles |
|
|
59 | (1) |
|
|
59 | (2) |
|
5 Sharing images with Docker Hub and other registries |
|
|
61 | (14) |
|
5.1 Working with registries, repositories, and image tags |
|
|
61 | (2) |
|
5.2 Pushing your own images to Docker Hub |
|
|
63 | (3) |
|
5.3 Running and using your own Docker registry |
|
|
66 | (4) |
|
5.4 Using image tags effectively |
|
|
70 | (2) |
|
5.5 Turning official images into golden images |
|
|
72 | (2) |
|
|
74 | (1) |
|
6 Using Docker volumes fin-persistent storage |
|
|
75 | (20) |
|
6.1 Why data in containers is not permanent |
|
|
75 | (5) |
|
6.2 Running containers with Docker volumes |
|
|
80 | (5) |
|
6.3 Running containers with filesystem mounts |
|
|
85 | (3) |
|
6.4 Limitations of filesystem mounts |
|
|
88 | (4) |
|
6.5 Understanding how the container filesystem is built |
|
|
92 | (1) |
|
|
93 | (2) |
|
PART 2 Running distributed applications in containers |
|
|
95 | (110) |
|
7 Running multi-container apps with Docker Compose |
|
|
97 | (20) |
|
7.1 The anatomy of a Docker Compose file |
|
|
97 | (4) |
|
7.2 Running a multi-container application with Compose |
|
|
101 | (6) |
|
7.3 How Docker plugs containers together |
|
|
107 | (3) |
|
7.4 Application configuration in Docker Compose |
|
|
110 | (4) |
|
7.5 Understanding the problem Docker Compose solves |
|
|
114 | (2) |
|
|
116 | (1) |
|
8 Supporting reliability with health checks and dependency checks |
|
|
117 | (20) |
|
8.1 Building health checks into Docker images |
|
|
117 | (6) |
|
8.2 Starting containers with dependency checks |
|
|
123 | (3) |
|
8.3 Writing custom utilities for application check logic |
|
|
126 | (4) |
|
8.4 Defining health checks and dependency checks in Docker Compose |
|
|
130 | (4) |
|
8.5 Understanding how checks power self-healing apps |
|
|
134 | (1) |
|
|
135 | (2) |
|
9 Adding observability with containerized monitoring |
|
|
137 | (24) |
|
9.1 The monitoring stack for containerized applications |
|
|
137 | (6) |
|
9.2 Exposing metrics from your application |
|
|
143 | (4) |
|
9.3 Running a Prometheus container to collect metrics |
|
|
147 | (5) |
|
9.4 Running a Grafana container to visualize metrics |
|
|
152 | (7) |
|
9.5 Understanding the levels of observability |
|
|
159 | (1) |
|
|
159 | (2) |
|
10 Running multiple environments with Docker Compose |
|
|
161 | (44) |
|
10.1 Deploying many applications with Docker Compose |
|
|
161 | (4) |
|
10.2 Using Docker Compose override files |
|
|
165 | (7) |
|
10.3 Injecting configuration with environment variables and secrets |
|
|
172 | (5) |
|
10.4 Reducing duplication with extension fields |
|
|
177 | (3) |
|
10.5 Understanding the configuration workflow with Docker |
|
|
180 | (1) |
|
|
181 | (2) |
|
11 Building and testing applications with Docker and Docker Compose |
|
|
183 | (1) |
|
11.1 How the CI process works with Docker |
|
|
183 | (2) |
|
11.2 Spinning up build infrastructure with Docker |
|
|
185 | (9) |
|
11.3 Capturing build settings with Docker Compose |
|
|
194 | (4) |
|
11.4 Writing CI jobs with no dependencies except Docker |
|
|
198 | (4) |
|
11.5 Understanding containers in the CI process |
|
|
202 | (1) |
|
|
203 | (2) |
|
PART 2 RUNNING AT SCALE WITH A CONTAINER ORCHESTATOR |
|
|
205 | (114) |
|
12 Understanding orchestration: Docker Swarm and Kubernetes |
|
|
207 | (23) |
|
12.1 What is a container orchestrator? |
|
|
207 | (3) |
|
12.2 Setting up a Docker Swarm cluster |
|
|
210 | (3) |
|
12.3 Running applications as Docker Swarm services |
|
|
213 | (7) |
|
12.4 Managing network traffic in the cluster |
|
|
220 | (6) |
|
12.5 Understanding the choice between Docker Swarm and Kubernetes |
|
|
226 | (3) |
|
|
229 | (1) |
|
1 Deploying distributed applications as stacks JS in Docker Swarm |
|
|
230 | (20) |
|
13.1 Using Docker Compose for production deployments |
|
|
231 | (4) |
|
13.2 Managing app configuration with config objects |
|
|
235 | (5) |
|
13.3 Managing confidential settings with secrets |
|
|
240 | (4) |
|
13.4 Storing data with volumes in the Swarm |
|
|
244 | (4) |
|
13.5 Understanding how the cluster manages stacks |
|
|
248 | (1) |
|
|
249 | (1) |
|
14 A Automating releases with upgrades and rollbacks |
|
|
250 | (21) |
|
14.1 The application upgrade process with Docker |
|
|
250 | (5) |
|
14.2 Configuring production rollouts with Compose |
|
|
255 | (4) |
|
14.3 Configuring service rollbacks |
|
|
259 | (5) |
|
14.4 Managing downtime for your cluster |
|
|
264 | (4) |
|
14.5 Understanding high availability in Swarm clusters |
|
|
268 | (1) |
|
|
269 | (2) |
|
15 Configuring Docker for secure remote access and CI/CD |
|
|
271 | (24) |
|
15.1 Endpoint options for the Docker API |
|
|
272 | (4) |
|
15.2 Configuring Docker for secure remote access |
|
|
276 | (8) |
|
15.3 Using Docker Contexts to work with remote engines |
|
|
284 | (3) |
|
15.4 Adding continuous deployment to your CI pipeline |
|
|
287 | (6) |
|
15.5 Understanding the access model for Docker |
|
|
293 | (1) |
|
|
294 | (1) |
|
16 Building Docker images that run anywhere: Linux, Windows, Intel, and Arm |
|
|
295 | (24) |
|
16.1 Why multi-architecture images are important |
|
|
295 | (4) |
|
16.2 Building multi-arch images from one or more Dockerfiles |
|
|
299 | (5) |
|
16.3 Pushing multi-arch images to registries with manifests |
|
|
304 | (5) |
|
16.4 Building multi-arch images with Docker Buildx |
|
|
309 | (5) |
|
16.5 Understanding where multi-arch images fit in your roadmap |
|
|
314 | (1) |
|
|
315 | (4) |
|
PART 1 GETTING YOUR CONTAINERS READY FOR PRODUCTION |
|
|
|
17 Optimizing Your Docker Images For Size, Speed, and security |
|
|
319 | (20) |
|
17.1 How you optimize Docker images |
|
|
319 | (5) |
|
17.2 Choosing the right base images |
|
|
324 | (6) |
|
17.3 Minimizing image layer count and layer size |
|
|
330 | (3) |
|
17.4 Taking your multi-stage builds to the next level |
|
|
333 | (4) |
|
17.5 Understanding why optimization counts |
|
|
337 | (1) |
|
|
337 | (2) |
|
18 Application configuration management in containers |
|
|
339 | (20) |
|
18.1 A multi-tiered approach to app configuration |
|
|
339 | (4) |
|
18.2 Packaging config for every environment |
|
|
343 | (4) |
|
18.3 Loading configuration from the runtime |
|
|
347 | (4) |
|
18.4 Configuring legacy apps in the same way as new apps |
|
|
351 | (6) |
|
18.5 Understanding why a flexible configuration model pays off |
|
|
357 | (1) |
|
|
358 | (1) |
|
19 Writing and managing application logs with Docker |
|
|
359 | (22) |
|
19.1 Welcome to stderr and stdout! |
|
|
359 | (5) |
|
19.2 Relaying logs from other sinks to stdout |
|
|
364 | (4) |
|
19.3 Collecting and forwarding container logs |
|
|
368 | (7) |
|
19.4 Managing your log output and collection |
|
|
375 | (4) |
|
19.5 Understanding the container logging model |
|
|
379 | (1) |
|
|
380 | (1) |
|
20 Controlling HTTP traffic to containers with a reverse proxy |
|
|
381 | (26) |
|
20.1 What is a reverse proxy? |
|
|
381 | (6) |
|
20.2 Handling routing and SSL in the reverse proxy |
|
|
387 | (5) |
|
20.3 Improving performance and reliability with the proxy |
|
|
392 | (4) |
|
20.4 Using a cloud-native reverse proxy |
|
|
396 | (7) |
|
20.5 Understanding the patterns a reverse proxy enables |
|
|
403 | (2) |
|
|
405 | (2) |
|
21 Asynchronous communication with a message queue |
|
|
407 | (18) |
|
21.1 What is asynchronous messaging? |
|
|
407 | (5) |
|
21.2 Using a cloud-native message queue |
|
|
412 | (4) |
|
21.3 Consuming and handling messages |
|
|
416 | (3) |
|
21.4 Adding new features with message handlers |
|
|
419 | (3) |
|
21.5 Understanding async messaging patterns |
|
|
422 | (2) |
|
|
424 | (1) |
|
|
425 | (4) |
|
22.1 Run your own proof-of-concept |
|
|
425 | (1) |
|
22.2 Make a case for Docker in your organization |
|
|
426 | (1) |
|
22.3 Plan the path to production |
|
|
427 | (1) |
|
22.4 Meet the Docker community |
|
|
427 | (2) |
Index |
|
429 | |