The ultimate Docker container book build, test, ship, and run containers with Docker and Kubernetes
The Ultimate Docker Container Book, 3rd edition enables you to leverage Docker containers for streamlined software development. You’ll uncover Docker fundamentals and how containers improve software supply chain efficiency and enhance security. You’ll start by learning practical skills such as setti...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham, England :
Packt Publishing Ltd
[2023]
|
Edición: | Third edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009764837306719 |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright and Credits
- Contributors
- Table of Contents
- Preface
- Part 1:Introduction
- Chapter 1: What Are Containers and Why Should I Use Them?
- What are containers?
- Why are containers important?
- What is the benefit of using containers for me or for my company?
- The Moby project
- Docker products
- Docker Desktop
- Docker Hub
- Docker Enterprise Edition
- Container architecture
- Summary
- Further reading
- Questions
- Answers
- Chapter 2: Setting Up a Working Environment
- Technical requirements
- The Linux command shell
- PowerShell for Windows
- Installing and using a package manager
- Installing Homebrew on macOS
- Installing Chocolatey on Windows
- Installing Git and cloning the code repository
- Choosing and installing a code editor
- Installing VS Code on macOS
- Installing VS Code on Windows
- Installing VS Code on Linux
- Installing VS Code extensions
- Installing Docker Desktop on macOS or Windows
- Testing Docker Engine
- Testing Docker Desktop
- Installing Docker Toolbox
- Enabling Kubernetes on Docker Desktop
- Installing minikube
- Installing minikube on Linux, macOS, and Windows
- Testing minikube and kubectl
- Working with a multi-node minikube cluster
- Installing Kind
- Testing Kind
- Summary
- Further reading
- Questions
- Answers
- Part 2:Containerization Fundamentals
- Chapter 3: 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
- The anatomy of containers
- Architecture
- Namespaces
- Control groups
- Union filesystem
- Container plumbing
- Summary
- Further reading
- Questions
- Answers
- Chapter 4: Creating and Managing Container Images
- What are images?
- The layered filesystem
- The writable container layer
- Copy-on-write
- Graph drivers
- Creating Docker images
- Interactive image creation
- Using Dockerfiles
- Saving and loading images
- Lift and shift - containerizing a legacy app
- Analyzing external dependencies
- Source code and build instructions
- Configuration
- Secrets
- Authoring the Dockerfile
- Why bother?
- Sharing or shipping images
- Tagging an image
- Demystifying image namespaces
- Explaining official images
- Pushing images to a registry
- Summary
- Questions
- Answers
- Chapter 5: Data Volumes and Configuration
- Technical requirements
- Creating and mounting data volumes
- Modifying the container layer
- Creating volumes
- Mounting a volume
- Removing volumes
- Accessing Docker volumes
- 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
- Further reading
- Questions
- Answers
- Chapter 6: 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 Java and Spring Boot
- 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
- Answers
- Chapter 7: Testing Applications Running in Containers
- Technical requirements
- Benefits of testing applications in containers
- Why do we test?
- Manual versus automated testing
- Why do we test in containers?
- Different types of testing
- Unit tests
- Integration tests
- Acceptance tests
- Commonly used tools and technologies
- Implementing a sample component
- Implementing and running unit and integration tests
- Implementing and running black box tests
- Best practices for setting up a testing environment
- Tips for debugging and troubleshooting issues
- Challenges and considerations when testing applications running in containers
- Case studies
- Summary
- Questions
- Answers
- Chapter 8: Increasing Productivity with Docker Tips and Tricks
- Technical requirements
- Keeping your Docker environment clean
- Using a .dockerignore file
- Executing simple admin tasks in a container
- Running a Perl script
- Running a Python script
- Limiting the resource usage of a container
- Avoiding running a container as root
- Running Docker from within Docker
- Optimizing your build process
- Scanning for vulnerabilities and secrets
- Using Snyk to scan a Docker image
- Using docker scan to scan a Docker image for vulnerabilities
- Running your development environment in a container
- Summary
- Questions
- Answers
- Part 3:Orchestration Fundamentals
- Chapter 9: Learning about Distributed Application Architecture
- What is a distributed application architecture?
- Defining the terminology
- Patterns and best practices
- Loosely coupled components.
- Stateful versus stateless
- Service discovery
- Routing
- Load balancing
- Defensive programming
- Redundancy
- Health checks
- Circuit breaker pattern
- Running in production
- Logging
- Tracing
- Monitoring
- Application updates
- Summary
- Further reading
- Questions
- Answers
- Chapter 10: Using Single-Host Networking
- Technical requirements
- Dissecting the container network model
- Network firewalling
- Working with the bridge network
- The host and null networks
- 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
- Further reading
- Questions
- Answers
- Chapter 11: Managing Containers with Docker Compose
- Technical requirements
- Demystifying declarative versus imperative orchestration of containers
- 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
- Further reading
- Questions
- Answers
- Chapter 12: Shipping Logs and Monitoring Containers
- Technical requirements
- Why is logging and monitoring important?
- Shipping containers and Docker daemon logs
- Shipping container logs
- Shipping Docker daemon logs
- Querying a centralized log
- Step 1 - accessing Kibana
- Step 2 - setting up an index pattern
- Step 3 - querying the logs in Kibana
- Step 4 - visualizing the logs
- Collecting and scraping metrics
- Step 1 - running cAdvisor in a Docker container
- Step 2 - setting up and running Prometheus
- Monitoring a containerized application
- Step 1 - setting up Prometheus.
- Step 2 - instrumenting your application with Prometheus metrics
- Step 3 - configuring Prometheus to scrape your application metrics
- Step 4 - setting up Grafana for visualization
- Step 5 - setting up alerting (optional)
- Step 6 - monitoring your containerized application
- Summary
- Questions
- Answers
- Chapter 13: Introducing Container Orchestration
- 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
- Data persistence and storage management
- Zero downtime deployments
- Affinity and location awareness
- Security
- Introspection
- Overview of popular orchestrators
- Kubernetes
- Docker Swarm
- Apache Mesos and Marathon
- Amazon ECS
- AWS EKS
- Microsoft ACS and AKS
- Summary
- Further reading
- Questions
- Answers
- Chapter 14: Introducing Docker Swarm
- The Docker Swarm architecture
- Swarm nodes
- Stacks, services, and tasks
- Services
- Tasks
- Stacks
- Multi-host networking
- Creating a Docker Swarm
- Creating a local single-node swarm
- Using PWD to generate a Swarm
- Creating a Docker Swarm in the cloud
- Deploying a first application
- Creating a service
- Inspecting the service and its tasks
- Testing the load balancing
- Logs of a service
- Reconciling the desired state
- Deleting a service or a stack
- Deploying a multi-service stack
- Removing the swarm in AWS
- Summary
- Questions
- Answers
- Chapter 15: Deploying and Running a Distributed Application on Docker Swarm
- The swarm routing mesh
- Zero-downtime deployment
- Popular deployment strategies
- Rolling updates
- Health checks
- Rolling back
- Blue-green deployments
- Canary releases
- Storing configuration data in the swarm.
- Protecting sensitive data with Docker secrets.