Lesson 2.1: Docker Concepts
Completion requirements
What is Docker?
Docker is a containerization platform that packages applications and their dependencies into lightweight, portable containers.
Key Concepts
Images vs Containers
- Image: Read-only template (like a blueprint)
- Container: Running instance of an image
Dockerfile
Text file with instructions to build an image:
FROM nginx:alpine
COPY ./html /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Docker Registry
Repository for Docker images:
- Docker Hub: Public registry
- Private Registry: Self-hosted
- GitHub Container Registry: Integrated with GitHub
Docker Architecture
Understanding the Docker ecosystem:
- Docker Engine: Core runtime
- Docker CLI: Command-line interface
- Docker Daemon: Background service
- Docker API: REST API for automation
Essential Docker Commands
# Image Management
docker pull nginx:alpine
docker images
docker rmi nginx:alpine
# Container Management
docker run -d --name web nginx:alpine
docker ps
docker ps -a
docker stop web
docker start web
docker rm web
# Logs and Debugging
docker logs web
docker exec -it web /bin/sh
docker inspect web
Why Docker for Personal Cloud?
- Isolation: Services don not interfere with each other
- Portability: Run anywhere Docker is installed
- Consistency: Same environment across development/production
- Resource Efficiency: Lightweight compared to VMs
- Easy Updates: Pull new image versions
MCT Services Docker Strategy
Our approach to containerizing services:
- Official Images: Use official images when available
- LinuxServer.io: Community-maintained images
- Custom Images: Build when necessary
- Security: Regular image updates
Container Networking Basics
Docker networking modes:
- Bridge: Default isolated network
- Host: Use host network directly
- None: No networking
- Custom: User-defined networks
Volume Management
Persistent data strategies:
- Named Volumes: Docker-managed storage
- Bind Mounts: Host directory mapping
- tmpfs: In-memory storage
Practical Exercise
Task: Run your first containerized service
- Install Docker on your system
- Pull the nginx image
- Run nginx container with port mapping
- Access the service via browser
- Examine logs and container details
- Stop and remove the container
Last modified: Thursday, 6 November 2025, 8:48 AM