Docker: A Practical Guide to App Runtime and Containerization

DevOps

YOUR COSMETIC CARE STARTS HERE

Find the Best Cosmetic Hospitals

Trusted • Curated • Easy

Looking for the right place for a cosmetic procedure? Explore top cosmetic hospitals in one place and choose with confidence.

“Small steps lead to big changes — today is a perfect day to begin.”

Explore Cosmetic Hospitals Compare hospitals, services & options quickly.

✓ Shortlist providers • ✓ Review options • ✓ Take the next step with confidence

Here’s a polished reference document based on your raw notes, organized and enriched with contextual details for better understanding and usability. This can serve as a training handout or quick reference for someone learning Docker fundamentals.


🐳 Docker: A Practical Guide to App Runtime and Containerization

📌 Overview: It’s All About Running the App!

To deploy modern applications efficiently, we transition through multiple abstractions:

Physical Server → Virtual Server → Container
TypeStartup Time
Physical Server5 minutes
Virtual Machine20 seconds
Container~1 second

🐳 What is Docker?

Docker is a container management platform that enables the building, shipping, and running of applications consistently across different environments.

✅ Why Use Docker?

  • Saves Time – Fast setup, teardown, and portability.
  • Reduces Cost – Lower overhead compared to VMs.
  • Improves Quality – Ensures consistency across development and production.

Container = Lightweight app runtime environment packaged with all its dependencies.


🧪 Assignment #1: How Do Containers Work?

Container Architecture

Unlike VMs, containers share the host OS kernel. They are isolated, fast, and lightweight.

Virtual Machine Components

  • Hypervisor: Manages VMs (e.g., VirtualBox, VMware).
  • Image (ISO): Contains OS + Kernel + Apps.
  • Boot Process: Hypervisor → Kernel (BOOTFS) → Root Filesystem (ROOTFS) → App

Docker Components

ComponentPurpose
Docker EngineThe core engine to build/run containers
Docker ImageTemplate that includes ROOTFS + app (e.g., ubuntu + java)
Docker RegistryPublic (e.g., Docker Hub) or private image storage
Docker ContainerRunning instance created from an image

🧱 Ubuntu as a Docker Image

  • Ubuntu Image = Linux Kernel (host) + ROOTFS of Ubuntu

🛠 Docker Installation and Setup Steps

Step 1 – Install Docker

sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
  https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Code language: PHP (php)

Step 2 – Download Docker Image

docker pull httpd

Step 3 – Manage Docker Containers

docker create httpd
docker start <container_id>
docker stop <container_id>
docker restart <container_id>
docker pause <container_id>
docker unpause <container_id>
docker kill <container_id>
docker rm <container_id>
Code language: HTML, XML (xml)

Step 4 – Connect to Running Container

docker exec -it <container_id> /bin/bash
Code language: HTML, XML (xml)

Step 5 – Expose Container to Host

docker run -d -p 80:80 httpd
Code language: CSS (css)

⚙️ Docker Run Modes

CommandBehavior
docker runpull + create + start + attach to STDOUT
docker run -dpull + create + start (run in detached mode)

🧠 Behind the Scenes: Process Flow

HUMAN → docker CLI → dockerd → containerd → kernel

🧪 Sample Docker Commands

ActionCommand Example
Check Docker Infodocker info
Pull Imagedocker pull httpd
List Imagesdocker images
Run Containerdocker run -d httpd
Map Portdocker run -d -p 80:80 httpd
Inspect Containerdocker inspect <container_id>
Access Containerdocker exec -it <id> /bin/bash
Show Statsdocker stats

📚 References and Further Learning


Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x