MOTOSHARE πποΈ
Turning Idle Vehicles into Shared Rides & Earnings
From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.
With Motoshare, every parked vehicle finds a purpose.
Owners earn. Renters ride.
π Everyone wins.
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
| Type | Startup Time |
|---|---|
| Physical Server | 5 minutes |
| Virtual Machine | 20 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
| Component | Purpose |
|---|---|
| Docker Engine | The core engine to build/run containers |
| Docker Image | Template that includes ROOTFS + app (e.g., ubuntu + java) |
| Docker Registry | Public (e.g., Docker Hub) or private image storage |
| Docker Container | Running 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
| Command | Behavior |
|---|---|
docker run | pull + create + start + attach to STDOUT |
docker run -d | pull + create + start (run in detached mode) |
π§ Behind the Scenes: Process Flow
HUMAN β docker CLI β dockerd β containerd β kernel
π§ͺ Sample Docker Commands
| Action | Command Example |
|---|---|
| Check Docker Info | docker info |
| Pull Image | docker pull httpd |
| List Images | docker images |
| Run Container | docker run -d httpd |
| Map Port | docker run -d -p 80:80 httpd |
| Inspect Container | docker inspect <container_id> |
| Access Container | docker exec -it <id> /bin/bash |
| Show Stats | docker stats |
π References and Further Learning
- π Complete Docker CLI Reference
- π How to Install Docker in Linux
- π€ What is Docker?
- π Docker Architecture & Components Explained