Skip to main content

Command Palette

Search for a command to run...

Day 142: Introduction to Containerization and Docker

Beginner's Guide to Containerization and Docker

Published
β€’3 min read
Day 142: Introduction to Containerization and Docker

Today marks an exciting shift in my DevOps journey β€” stepping into containerization and exploring Docker, one of the most powerful tools in modern infrastructure and DevOps workflows.

After setting up multiple AWS services and automating builds with CodeBuild, it’s time to understand how applications are packaged, shipped, and run consistently across environments β€” thanks to containers.


πŸš€ What is Containerization?

Containerization is a lightweight form of virtualization that allows you to package an application and its dependencies into a single unit called a container.

These containers run consistently across:

  • Developer laptops πŸ§‘β€πŸ’»

  • Testing servers πŸ§ͺ

  • Production environments ☁️

Unlike traditional virtual machines, containers don’t need a full OS β€” they share the host’s kernel, making them faster, smaller, and more portable.


βš™οΈ Virtual Machines vs Containers

FeatureVirtual MachineContainer
OSFull guest OS per VMShares host OS kernel
SizeGBsMBs
Startup TimeMinutesSeconds
IsolationStrong (via hypervisor)Process-level
PerformanceSlight overheadNear-native
PortabilityLimitedExtremely portable

πŸ’‘ Containers revolutionized DevOps by enabling β€œbuild once, run anywhere.”


πŸ‹ What is Docker?

Docker is the most popular containerization platform.
It provides tools and commands to:

  • Build container images πŸ—οΈ

  • Run containers πŸš€

  • Share containers via Docker Hub 🌐

  • Manage networks and volumes πŸ”—

With Docker, you can define how your app runs in a Dockerfile, then package and deploy it consistently on any machine.


πŸ“¦ Core Docker Components

  1. Docker Engine – The runtime that builds and runs containers.

  2. Docker Images – Immutable blueprints for containers (built from a Dockerfile).

  3. Docker Containers – Running instances of Docker images.

  4. Docker Hub / Registry – Centralized repositories to store and distribute images.

  5. Docker CLI & Daemon – Tools for interacting with and managing containers.


🧱 Example: Building a Simple Docker Image

Here’s a minimal Dockerfile for a Node.js app:

# Use official Node.js image
FROM node:18-alpine

# Set working directory
WORKDIR /app

# Copy package files and install dependencies
COPY package*.json ./
RUN npm install

# Copy all source code
COPY . .

# Expose port
EXPOSE 3000

# Start the app
CMD ["npm", "start"]

Build and run it:

docker build -t my-node-app .
docker run -p 3000:3000 my-node-app

Boom πŸ’₯ β€” your app is running inside a container, isolated from your system!


🧩 Why Docker Matters in DevOps

Docker is a cornerstone of modern DevOps pipelines because it:

  • Eliminates β€œworks on my machine” issues.

  • Simplifies environment management.

  • Enables microservices architecture.

  • Integrates seamlessly with CI/CD tools like Jenkins, GitHub Actions, and CodePipeline.

  • Forms the base for orchestration tools like Kubernetes and ECS.


🧠 Key Takeaways

βœ… Containers are lightweight, portable, and fast.
βœ… Docker simplifies container creation, sharing, and deployment.
βœ… It’s a foundational tool in CI/CD, cloud, and Kubernetes ecosystems.
βœ… Mastering Docker = mastering the foundation of cloud-native DevOps.

DevOps overview as a beginner

Part 1 of 50

Sharing my journey of learning DevOps as a beginner β€” covering essential tools, cloud setup, CI/CD, Docker, monitoring, and more, step by step with practical examples.