What is a container ?

Sonica SonawaneSonica Sonawane
3 min read

A container is a lightweight, standalone, and executable software package that includes everything needed to run a piece of software: the code, runtime, system tools, libraries, and dependencies.

In Simple Terms:

Think of a container like a box that holds your application along with all the things it needs to run, so it behaves the same way regardless of where it's run: your laptop, a server, or the cloud.


Key Features of Containers:

  • Isolated: Runs separately from other applications and system processes.

  • Portable: Can run on any system with a container engine (like Docker), no matter the underlying OS.

  • Lightweight: Uses the host operating system's kernel, unlike virtual machines which require an entire OS.


Why Containers Are Popular:

  • Fast startup time compared to virtual machines

  • Easy to scale in cloud environments

  • Consistent environments from development to production

  • Simplifies deployment and reduces bugs from system differences


Example:

Imagine you're developing a Python web app. A container can package:

  • Your Python code

  • Required libraries (like Flask, Pandas, etc.)

  • A specific Python version

  • Environment variables

So when you or someone else runs this container, it will just work, regardless of the host machine’s configuration.

Containers vs. Virtual Machines — Shipping Analogy

Containers = Shipping Containers

  • Imagine a standardized metal shipping container.

  • It can carry any goods: clothes, electronics, furniture.

  • It can be loaded onto ships, trains, or trucks without needing to unpack and repack it.

  • The contents are isolated and protected, and the container ensures consistency wherever it's shipped.

💡 This is just like a software container — it holds everything your app needs (code + dependencies), and it can run anywhere without changing what's inside.


Virtual Machines = Entire Trucks

  • A virtual machine is like sending goods in a full truck, including the engine, cabin, wheels, etc., even when you just need to deliver some boxes.

  • It works but is heavy, slow to start, and takes up more resources.

Containerized Applications (Docker)

  • Apps (A–F): These are individual containerized applications.

  • Docker: The container runtime. It shares the host OS and runs each app in isolated user-space environments.

  • Host Operating System: A single OS that is shared by all containers.

  • Infrastructure: The physical or virtual hardware layer (CPU, RAM, storage, etc.).

Key Point:
Containers share the host OS, making them lightweight, fast to start, and efficient in resource usage.

Virtual Machines (VMs)

  • Each Virtual Machine (VM) contains:

    • An app (App A, B, or C)

    • Its own Guest Operating System (OS), which adds overhead.

  • Hypervisor: Manages and runs multiple VMs on the same infrastructure.

  • Infrastructure: The same physical hardware.

Key Point:
VMs are heavier than containers because each one includes a full OS. They provide stronger isolation but consume more resources.

FeatureContainersVirtual Machines
OS SharingYes (Host OS)No (each has own OS)
Startup TimeFastSlower
Resource EfficiencyHighLower
IsolationModerateStrong
SizeLightweightHeavy

This image effectively explains why containers are preferred in modern cloud-native and DevOps workflows for scalability and performance.

0
Subscribe to my newsletter

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

Written by

Sonica Sonawane
Sonica Sonawane

Hi, I'm Sonica! 👋 I’m currently diving into the world of DevOps, focusing on AWS, Docker, Kubernetes, Linux, and GitHub. My passion lies in automating systems, building cloud infrastructure, and optimizing workflows. I’m committed to continuous learning, hands-on projects, and sharing my journey with others in the tech community. Before shifting to DevOps, I worked in IT Sales, where I gained valuable skills in client communication, requirement gathering, and problem-solving. This experience taught me how to connect technical solutions to business needs, which has been instrumental as I transition into DevOps, where technical expertise and problem-solving go hand in hand. Now, I’m eager to apply my sales experience alongside my growing technical skills in cloud engineering and DevOps. Join me as I explore the latest trends, challenges, and solutions in the world of cloud computing!