If you’re getting into DevOps, system administration, or modern development, learning Docker is non-negotiable. Docker allows you to run applications in isolated environments called containers — fast, lightweight, and portable.
In this guide, you’ll learn how to install Docker and run your first container in minutes.
🔹 What is Docker?
Docker is a platform that lets you package applications with all their dependencies into a container.
👉 Think of it like:
- A mini virtual machine (but lighter)
- Runs the same everywhere (no “it works on my machine”)
🔹 Install Docker (Ubuntu 22.04)
sudo apt update
sudo apt install -y ca-certificates curl gnupg
sudo install -m 0755 -d /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 \
$(. /etc/os-release && echo $VERSION_CODENAME) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
🔹 Verify Installation
docker --version
🔹 Run Your First Container
docker run hello-world
✔ This will:
- Pull an image from Docker Hub
- Run it inside a container
- Print a success message
🔹 Run an Interactive Container
docker run -it ubuntu bash
Now you’re inside a container shell 👇
ls
apt update
Type exit to leave.
🔹 Common Docker Commands
docker ps # Running containers
docker ps -a # All containers
docker images # List images
docker stop <id> # Stop container
docker rm <id> # Remove container
🔹 Why Docker is Powerful
- ⚡ Fast startup (seconds)
- 🔒 Isolation between apps
- 📦 Easy deployment
- ☁️ Works perfectly with cloud & VPS