#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

DevOps · Docker Basics

Docker Basics Explained in Plain Simple Language

Docker basics explained in plain simple language — containers vs virtual machines, images vs containers, writing your first Dockerfile, volumes, networking, and Docker Compose for absolute beginners.

Tracks
Docker Concepts · Live Interactive
Concept
—
Core Docker idea
What It Does
—
Plain simple meaning
Real Example
—
Everyday analogy
Write → Build → Run → Ship
Click a concept to understand it in plain language. Build, run, and ship your first container step by step.

Home / Tutorials / DevOps / Docker Basics Explained in Plain Simple Language

DevOps · Docker Basics

Docker Basics Explained in Plain Simple Language

WRITE BUILD RUN SHIP Dockerfile Recipe for your app Text file of steps Recipe Image Packaged snapshot Read-only template Build Container Running app instance Isolated process Run Ship Push to registry Deploy anywhere Deploy
Docker in one picture — write a Dockerfile, build an image, run a container, and ship it anywhere.

Quick summary — Docker basics in plain simple language

Docker lets you package your app and everything it needs into a single box that runs the same way on any machine. No more "it works on my laptop" problems. This guide explains the basics in plain simple language — no prior DevOps knowledge required.

In this guide you will learn:

  1. What is Docker and why it matters — in plain simple language.
  2. Containers vs virtual machines — the key difference.
  3. Images vs containers — the recipe vs the cooked dish.
  4. Your first Dockerfile — step-by-step with examples.
  5. Volumes, networking & Docker Compose — practical examples.

SECTION 01What is Docker and Why It Matters

Docker is a tool that packages your application and everything it needs — code, libraries, dependencies, and settings — into a single unit called a container. Here's the plain simple version:

Term Plain Simple Meaning Everyday Analogy Why It Matters
Docker A tool for running apps inside containers A lunchbox factory Same app runs on every machine
Container A running box with your app inside A sealed lunchbox with your meal Isolated, portable, fast
Image A saved recipe of your container The recipe card You can build many containers from it
Dockerfile A text file listing steps to build an image The steps on the recipe card Repeatable and version-controlled
Docker Hub An online store for images A supermarket of recipes Reuse images made by others
Docker — Core Concepts in Plain Words:

Docker:
  A tool that lets you package an app with
  everything it needs so it runs the same way
  everywhere.

Container:
  A live, running version of your app.
  It has its own filesystem, network, and processes,
  but shares the host OS kernel.

Image:
  A read-only template used to create containers.
  Think of it as a snapshot of your app + environment.

Dockerfile:
  A text file with step-by-step instructions
  to build an image.

Registry (e.g., Docker Hub):
  A place to store and share images.

Why Docker matters:
- Ends "works on my machine" problems
- Faster onboarding and deployment
- Lightweight compared to virtual machines
- Easy to ship, scale, and roll back
docker-core-concepts.md
Key insight: Docker is not magic — it is just a standard way of packaging an app with its environment. Once you understand the recipe analogy, everything else makes sense.

SECTION 02Containers vs Virtual Machines

Both isolate apps, but they work very differently. Here's the plain simple comparison:

Aspect Virtual Machine Container Plain Meaning
OS Full OS per VM Shares host OS kernel Containers are lighter
Size Gigabytes Megabytes Faster to ship
Boot time Minutes Seconds Faster iteration
Isolation Stronger (separate OS) Process-level isolation Good enough for most apps
Density Few per host Many per host Better resource usage
Use case Full OS environments Apps and microservices Containers for apps
Containers vs Virtual Machines — Plain Simple:

Virtual Machine:
  - Includes a full guest operating system
  - Boots slowly (minutes)
  - Heavier (GBs)
  - Stronger isolation
  - Good for running different OS types

Container:
  - Shares the host OS kernel
  - Boots in seconds
  - Lightweight (MBs)
  - Process-level isolation
  - Great for apps and microservices

One-line summary:
  VMs virtualize hardware.
  Containers virtualize the operating system.

Real-world impact:
  10 containers can easily run on a laptop.
  10 VMs would likely crash it.
containers-vs-vms.md
Key insight: Containers are not "smaller VMs" — they are a different way of isolating processes. Sharing the host kernel is what makes them so fast and lightweight.

SECTION 03Images vs Containers

This is the most confused pair in Docker. Here's the plain simple version:

Aspect Image Container Analogy
What it is A read-only template A running instance of an image Recipe vs cooked dish
Mutable? No — it's a snapshot Yes — it can change while running Photo vs live person
State Static file Running process Blueprint vs building
Count One image, many containers Many containers per image One recipe, many servings
Command docker build docker run Build vs run
Images vs Containers — Plain Simple:

Image:
  - A packaged snapshot of your app
  - Contains code, runtime, libraries, settings
  - Built once, reused many times
  - Does not run by itself

Container:
  - A running instance of an image
  - Has its own process and (optional) writable layer
  - You can start, stop, and delete containers
  - Many containers can run from one image

Analogy:
  Image = recipe card
  Container = cooked dish

Everyday example:
  The official nginx image is downloaded once.
  You can run 3 nginx containers from it,
  each with its own port and config.

Key commands:
  docker build -t myapp:1.0 .   # create image
  docker run -d -p 8080:80 myapp:1.0   # run container
images-vs-containers.md
Key insight: You build an image, and you run a container. Once you remember that, Docker becomes much easier to reason about.

SECTION 04Your First Dockerfile

A Dockerfile is a text file with simple instructions. Here's a beginner-friendly example for a small Node.js app:

# Dockerfile — a simple Node.js app

# 1. Start from a base image
FROM node:20-alpine

# 2. Set the working directory inside the container
WORKDIR /app

# 3. Copy package files first (better caching)
COPY package*.json ./

# 4. Install dependencies
RUN npm install

# 5. Copy the rest of the source code
COPY . .

# 6. Tell Docker which port the app uses
EXPOSE 3000

# 7. Command to start the app
CMD ["npm", "start"]
Dockerfile
Key insight: Each line in a Dockerfile is a step. Docker caches steps, so putting the rarely-changing lines (like installing dependencies) before the frequently-changing ones (like copying source code) makes rebuilds much faster.

SECTION 05Volumes, Networking & Docker Compose

Containers are temporary by default. Here's how to keep data, connect containers, and run multi-container apps:

Concept Plain Meaning Analogy Command
Volume Persistent storage outside the container A USB drive for your lunchbox docker run -v mydata:/app/data ...
Port mapping Expose a container port to your host A window on the box -p 8080:80
Network A private network for containers to talk A room with many people docker network create mynet
Compose A YAML file to run multiple containers A team of chefs docker compose up
# Volumes — keep data even if the container is deleted

# Named volume
docker volume create mydata
docker run -d -v mydata:/var/lib/mysql mysql:8

# Bind mount (host folder inside the container)
docker run -d -v $(pwd)/site:/usr/share/nginx/html nginx

# Networking — let containers talk to each other

docker network create mynet

docker run -d --name db  --network mynet mysql:8
docker run -d --name app --network mynet -p 3000:3000 my-node-app:1.0

# Inside the "app" container, "db" is reachable
# by hostname: db:3306

Plain simple:
  Volumes keep data safe.
  Networks let containers talk by name.
  Ports let you reach a container from your laptop.
docker-compose.yml
Key insight: Compose is the easiest way to run a real app — one file describes your app, your database, and how they connect. Start with one container, then add Compose when you need more.

SECTION 06Interview Q&A — Docker basics

Q1What is Docker in simple words?

Docker is a tool that packages an app with everything it needs into a container, so it runs the same way on any machine. It ends the "works on my machine" problem.

Q2What's the difference between an image and a container?

An image is a read-only template (a recipe). A container is a running instance of that image (the cooked dish). You can create many containers from one image.

Q3Containers vs virtual machines — which is better?

They serve different purposes. Containers are lighter, faster, and share the host kernel. VMs give stronger isolation with a full OS. Use containers for apps, VMs for infrastructure.

Q4What is a Dockerfile?

A Dockerfile is a text file with step-by-step instructions for building a Docker image. It defines the base image, dependencies, files to copy, ports, and the start command.

Q5What is Docker Compose used for?

Docker Compose lets you define and run multi-container apps with a single YAML file. You describe your app, database, and other services, and start them all with one command.

SECTION 07Test yourself — Docker basics quiz

Five questions. No sign-up.

0 / 5

Pick an answer to see why it is right or wrong.

SECTION 08Frequently asked questions

Is Docker the same as a virtual machine?

No. VMs include a full guest OS and are heavier. Containers share the host OS kernel and are much lighter and faster to start.

Do I need to know Linux to use Docker?

Basic Linux knowledge helps, but you don't need to be an expert. Understanding the terminal and file paths is enough to start.

What is Docker Hub?

Docker Hub is the default online registry for Docker images. You can download popular images like nginx, node, or postgres, and publish your own.

What's the difference between EXPOSE and -p?

EXPOSE in a Dockerfile is just documentation — it does not publish the port. The -p flag on docker run actually maps a container port to your host.

How do I persist data in a container?

Use a volume. Named volumes (like mydata:/app/data) survive container restarts and deletion. Bind mounts map a host folder directly into the container.

Classroom & online

Your Docker journey starts now

Our Docker & Kubernetes Training Course is designed for beginners — with hands-on labs, real projects, and interview prep that get you job-ready.

₹15,500 · full programme ₹24,000
  • Complete Docker roadmap
  • Hands-on lab projects
  • Mock interviews
  • Weekday & weekend batches