Day 62: Docker Basics: Understanding Containers, Virtual Machines, Buildah, and Hypervisors

Vishesh GhuleVishesh Ghule
3 min read

🚀 Introduction

If you’ve just started your DevOps journey, chances are you’ve heard about Docker and containers. But before we dive deep into Docker, it’s important to understand the key concepts that make containerization possible — containers, virtual machines, buildah, and hypervisors.


🔸Virtual Machines (VMs)

  • A Virtual Machine is like a computer running inside another computer. It has:

  • Its own full operating system (Linux, Windows, etc.)

  • Isolated CPU, RAM, and storage allocation

  • High security because of complete separation

  • How it works: VMs run on top of a physical server with the help of a hypervisor (more on that next). Each VM is completely isolated, which makes it secure but resource-heavy.

  • Drawback: If your app doesn’t use all the resources allocated to the VM, the rest goes to waste.

  • Example: You split a server with 100 GB RAM into four VMs with 25 GB each. If one VM’s app uses only 10 GB, 15 GB is wasted.


🔸Hypervisor

  • A hypervisor is software that allows multiple VMs to run on a single physical machine. It:

  • Divides hardware resources among VMs

  • Runs either directly on hardware (Type 1) or on an existing OS (Type 2)

  • Examples: VMware ESXi, VirtualBox, Microsoft Hyper-V, AWS EC2’s Xen Hypervisor.


🔸Containers

  • Containers are like lightweight virtual machines.

  • They package: Your application, Application dependencies (libraries, runtimes), Minimal system components needed to run

  • But unlike VMs, containers share the host OS kernel instead of having their own full OS.

  • Benefits: Much smaller in size (often in MBs instead of GBs), Start in seconds, Easy to move between environments

  • Drawback: They are less isolated than VMs, so security is slightly weaker.

  • Example: A Node.js container only has Node.js + required packages. It borrows the underlying Linux kernel from the host machine.


🔸Buildah

  • Buildah is a tool to build container images (similar to Docker images) without needing the Docker engine.

  • Why Buildah?

    Docker depends on the Docker Engine — a single point of failure. If it crashes, all containers stop.

    Buildah can build images directly, without a running daemon.

    Works seamlessly with Podman and Kubernetes.

    Supports building both Docker and OCI-compliant images.

Difference from Docker:

  • Docker uses a Dockerfile to build images.

  • Buildah lets you build using shell scripts or commands, giving you more flexibility.


🔸Comparing Containers and Virtual Machines

Containers and virtual machines have similar resource isolation and allocation benefits, but function differently because containers virtualize the operating system instead of hardware. Containers are more portable and efficient.


🚀 In short

  • Hypervisors make virtualization possible by running multiple Virtual Machines on one physical server.

  • Virtual Machines are secure but heavy, often wasting unused resources.

  • Containers are lightweight and portable, making them perfect for modern cloud-native applications.

  • Buildah is a flexible, Docker-alternative tool for building container images.


Thanks for reading to the end; I hope you gained some knowledge.❤️🙌

Linkedln

Twitter

Github

1
Subscribe to my newsletter

Read articles from Vishesh Ghule directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vishesh Ghule
Vishesh Ghule

I'm proficient in a variety of DevOps technologies, including AWS, Linux, Python, Docker, Git/Github, Shell Scripting, Jenkins and Computer Networking. My greatest strength is the ability to learn new things because I believe there is always room for self-development