Learn Docker:Fundamentals of Docker 19.x
Gabriel N. Schenker更新时间:2021-06-24 17:01:20
最新章节:Leave a review - let other readers know what you think封面
Title Page
Copyright and Credits
Learn Docker – Fundamentals of Docker 19.x Second Edition
About Packt
Why subscribe?
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Section 1: Motivation and Getting Started
What Are Containers and Why Should I Use Them?
What are containers?
Why are containers important?
What's the benefit for me or for my company?
The Moby project
Docker products
Docker CE
Docker EE
Container architecture
Summary
Questions
Further reading
Setting Up a Working Environment
Technical requirements
The Linux command shell
PowerShell for Windows
Using a package manager
Installing Homebrew on macOS
Installing Chocolatey on Windows
Installing Git
Choosing a code editor
Installing VS Code on macOS
Installing VS Code on Windows
Installing VS Code on Linux
Installing VS Code extensions
Installing Docker for Desktop
Installing Docker for Desktop on macOS
Installing Docker for Desktop on Windows
Installing Docker CE on Linux
Installing Docker Toolbox
Installing Docker Toolbox on macOS
Installing Docker Toolbox on Windows
Setting up Docker Toolbox
Installing Minikube
Installing Minikube on macOS and Windows
Testing Minikube and kubectl
Summary
Questions
Further reading
Section 2: Containerization from Beginner to Black Belt
Mastering Containers
Technical requirements
Running the first container
Starting stopping and removing containers
Running a random trivia question container
Listing containers
Stopping and starting containers
Removing containers
Inspecting containers
Exec into a running container
Attaching to a running container
Retrieving container logs
Logging drivers
Using a container-specific logging driver
Advanced topic – changing the default logging driver
Anatomy of containers
Architecture
Namespaces
Control groups (cgroups)
Union filesystem (Unionfs)
Container plumbing
runC
Containerd
Summary
Questions
Further reading
Creating and Managing Container Images
What are images?
The layered filesystem
The writable container layer
Copy-on-write
Graph drivers
Creating images
Interactive image creation
Using Dockerfiles
The FROM keyword
The RUN keyword
The COPY and ADD keywords
The WORKDIR keyword
The CMD and ENTRYPOINT keywords
A complex Dockerfile
Building an image
Multi-step builds
Dockerfile best practices
Saving and loading images
Lift and shift: Containerizing a legacy app
Analysis of external dependencies
Source code and build instructions
Configuration
Secrets
Authoring the Dockerfile
The base image
Assembling the sources
Building the application
Defining the start command
Why bother?
Sharing or shipping images
Tagging an image
Image namespaces
Official images
Pushing images to a registry
Summary
Questions
Further reading
Data Volumes and Configuration
Technical requirements
Creating and mounting data volumes
Modifying the container layer
Creating volumes
Mounting a volume
Removing volumes
Accessing volumes created with Docker for Desktop
Sharing data between containers
Using host volumes
Defining volumes in images
Configuring containers
Defining environment variables for containers
Using configuration files
Defining environment variables in container images
Environment variables at build time
Summary
Questions
Further reading
Debugging Code Running in Containers
Technical requirements
Evolving and testing code running in a container
Mounting evolving code into the running container
Auto restarting code upon changes
Auto-restarting for Node.js
Auto-restarting for Python
Auto-restarting for .NET
Line-by-line code debugging inside a container
Debugging a Node.js application
Debugging a .NET application
Instrumenting your code to produce meaningful logging information
Instrumenting a Python application
Instrumenting a .NET C# application
Using Jaeger to monitor and troubleshoot
Summary
Questions
Further reading
Using Docker to Supercharge Automation
Technical requirements
Executing simple admin tasks in a container
Using test containers
Integration tests for a Node.js application
The Testcontainers project
Using Docker to power a CI/CD pipeline
Summary
Questions
Further reading
Advanced Docker Usage Scenarios
Technical requirements
All of the tips and tricks of a Docker pro
Keeping your Docker environment clean
Running Docker in Docker
Formatting the output of common Docker commands
Filtering the output of common Docker commands
Optimizing your build process
Limiting resources consumed by a container
Read-only filesystem
Avoid running a containerized app as root
Running your Terminal in a remote container and accessing it via HTTPS
Running your development environment inside a container
Running your code editor in a remote container and accessing it via HTTPS
Summary
Questions
Further reading
Section 3: Orchestration Fundamentals and Docker Swarm
Distributed Application Architecture
Understanding the distributed application architecture
Defining the terminology
Patterns and best practices
Loosely coupled components
Stateful versus stateless
Service discovery
Routing
Load balancing
Defensive programming
Retries
Logging
Error handling
Redundancy
Health checks
Circuit breaker pattern
Running in production
Logging
Tracing
Monitoring
Application updates
Rolling updates
Blue-green deployments
Canary releases
Irreversible data changes
Rollback
Summary
Questions
Further reading
Single-Host Networking
Technical requirements
Dissecting the container network model
Network firewalling
Working with the bridge network
The host and null network
The host network
The null network
Running in an existing network namespace
Managing container ports
HTTP-level routing using a reverse proxy
Containerizing the monolith
Extracting the first microservice
Using Traefik to reroute traffic
Summary
Questions
Further reading
Docker Compose
Technical requirements
Demystifying declarative versus imperative
Running a multi-service app
Building images with Docker Compose
Running an application with Docker Compose
Scaling a service
Building and pushing an application
Using Docker Compose overrides
Summary
Questions
Further reading
Orchestrators
What are orchestrators and why do we need them?
The tasks of an orchestrator
Reconciling the desired state
Replicated and global services
Service discovery
Routing
Load balancing
Scaling
Self-healing
Zero downtime deployments
Affinity and location awareness
Security
Secure communication and cryptographic node identity
Secure networks and network policies
Role-based access control (RBAC)
Secrets
Content trust
Reverse uptime
Introspection
Overview of popular orchestrators
Kubernetes
Docker Swarm
Apache Mesos and Marathon
Amazon ECS
Microsoft ACS
Summary
Questions
Further reading
Introduction to Docker Swarm
The Docker Swarm architecture
Swarm nodes
Swarm managers
Swarm workers
Stacks services and tasks
Services
Task
Stack
Multi-host networking
Creating a Docker Swarm
Creating a local single node swarm
Creating a local Swarm in VirtualBox or Hyper-V
Using Play with Docker to generate a Swarm
Creating a Docker Swarm in the cloud
Deploying a first application
Creating a service
Inspecting the service and its tasks
Logs of a service
Reconciling the desired state
Deleting a service or a stack
Deploying a multi-service stack
The swarm routing mesh
Summary
Questions
Further reading
Zero-Downtime Deployments and Secrets
Technical requirements
Zero-downtime deployment
Popular deployment strategies
Rolling updates
Health checks
Rollback
Blue–green deployments
Canary releases
Storing configuration data in the swarm
Protecting sensitive data with Docker secrets
Creating secrets
Using a secret
Simulating secrets in a development environment
Secrets and legacy applications
Updating secrets
Summary
Questions
Further reading
Section 4: Docker Kubernetes and the Cloud
Introduction to Kubernetes
Technical requirements
Kubernetes architecture
Kubernetes master nodes
Cluster nodes
Introduction to Minikube
Kubernetes support in Docker for Desktop
Introduction to pods
Comparing Docker container and Kubernetes pod networking
Sharing the network namespace
Pod life cycle
Pod specifications
Pods and volumes
Kubernetes ReplicaSet
ReplicaSet specification
Self-healing
Kubernetes deployment
Kubernetes service
Context-based routing
Comparing SwarmKit with Kubernetes
Summary
Questions
Further reading
Deploying Updating and Securing an Application with Kubernetes
Technical requirements
Deploying a first application
Deploying the web component
Deploying the database
Streamlining the deployment
Defining liveness and readiness
Kubernetes liveness probe
Kubernetes readiness probe
Kubernetes startup probe
Zero downtime deployments
Rolling updates
Blue-green deployment
Kubernetes secrets
Manually defining secrets
Creating secrets with kubectl
Using secrets in a pod
Secret values in environment variables
Summary
Questions
Further reading
Monitoring and Troubleshooting an App Running in Production
Technical requirements
Monitoring an individual service
Instrumenting a Node.js-based service
Instrumenting a .NET Core-based service
Using Prometheus to monitor a distributed application
Architecture
Deploying Prometheus to Kubernetes
Deploying our application services to Kubernetes
Deploying Grafana to Kubernetes
Troubleshooting a service running in production
The netshoot container
Summary
Questions
Further reading
Running a Containerized App in the Cloud
Technical requirements
Deploying and using Docker EE on AWS
Provisioning the infrastructure
Installing Docker
Installing Docker UCP
Using remote admin for the UCP cluster
Deploying to Docker Swarm
Deploying to Kubernetes
Exploring Microsoft's Azure Kubernetes Service (AKS)
Preparing the Azure CLI
Creating a container registry on Azure
Pushing our images to ACR
Creating a Kubernetes cluster
Deploying our application to the Kubernetes cluster
Understanding GKE
Summary
Questions
Further reading
Assessments
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Chapter 17
Chapter 18
Other Books You May Enjoy
Leave a review - let other readers know what you think
更新时间:2021-06-24 17:01:20