Using Containerization
Containerization Concepts
🎯 Exam Objectives
Track your learning progress! Click each objective as you master it:
- Understand container architecture vs virtual machines
- Master the container workflow: config → image → running container
- Use Docker commands for container management
- Deploy containers using cloud registries
- Configure port mapping and storage types
📦 Containers vs Virtual Machines
Containers offer a different form of virtualization from VMs. While VMs virtualize hardware, containers virtualize the operating system, making them lightweight and portable.
🖥️ Virtual Machines
- Virtualizes hardware
- Includes full guest OS
- Heavyweight (GBs)
- Boot time: Minutes
- Strong isolation
📦 Containers
- Virtualizes OS
- Shares single OS kernel
- Lightweight (MBs)
- Boot time: Seconds
- Process-level isolation
🔄 Container Lifecycle Workflow
Click each stage to understand the container creation process:
⌨️ Docker Command Reference
The docker command is the primary management tool. Here are essential commands:
Core Docker Commands
| Command | Description | Example |
|---|---|---|
| docker pull | Pull an image from a registry | docker pull alpine |
| docker run | Run a command in a container | docker run -it alpine bash |
| docker ps | List containers | docker ps -a |
| docker images | List images | docker images |
| docker rm | Remove containers | docker rm container-id |
| docker rmi | Remove images | docker rmi image-name |
Container Management Commands
| Command | Description |
|---|---|
| docker container start | Start a stopped container |
| docker container stop | Stop a started container |
| docker container restart | Restart a container |
| docker container logs | Display container logs |
| docker container inspect | Display detailed container information |
🗄️ 6.11 Image Registries
Container image registries are storage repositories for container images. They integrate with DevOps and CI/CD processes, allowing orchestration to pull images on the fly.
☁️ 6.12 Containers in the Cloud
Cloud container services provide scalability, metered services, high availability, and reduced management overhead compared to on-premises solutions.
🛠️ Cloud Container Services
- Amazon ECS: Run, monitor, and scale apps with AWS integration
- Azure Kubernetes Service: Run containers on Kubernetes
- Google Compute Engine: Manage containers on Kubernetes/Docker
📋 Deployment Steps
- Create container instance
- Name and select region
- Choose image from registry
- Select CPU/Memory size
- Configure networking
- Tag for billing
🔧 6.13 Container Management
Port Mapping
Port mapping associates container ports with host ports, providing access between the container and external networks.
Storage Types
Containers support two main storage types. Click each to learn more:
Non-permanent storage tied to the container's lifecycle. Created and removed along with the container.
Use Cases:- Data caching
- Container logging
- Temporary scratch space
Independent of the container's lifecycle. Stores data even if the container is stopped or deleted. Necessary for stateful applications.
Implementation:- Persistent storage volumes point to actual storage media
- Can be statically or dynamically configured
- Shared across container clusters (e.g., AWS EKS + EFS)
Orchestration
Container workload orchestration enables large-scale management using DevOps approaches. It provides: