Skip to main content

Command Palette

Search for a command to run...

#18 Docker | 20 lakh job hunt

Published
5 min read
#18 Docker | 20 lakh job hunt
P

"Passionate DevOps enthusiast, automating workflows and optimizing infrastructure for a more efficient, scalable future."

🚀 Docker + Containers — A Beginner-Friendly Breakdown

Today’s project was all about Docker, containers, and finally deploying a containerised app to the cloud using AWS Elastic Beanstalk.

🔹 What is Docker Desktop?

A tool that helps you build, run, and manage containers from your computer.
Think of it as a user-friendly control panel for everything Docker does.


🔹 What Are Containers (and why do they exist)?

Ever heard the line:

“It works on my machine!”

Containers fix exactly this.

They bundle your app + all its required dependencies into one lightweight package.
So whether you run it on your Mac, Windows, Linux, or a cloud server —
it behaves the same. Always.

That's why containers are a favourite in modern DevOps and team development.


🔹 What Does Docker Actually Do?

Docker is the engine that helps you:

  • Create containers

  • Run them

  • Ship them

  • Manage them at scale

It makes working with containers fast and smooth.


🔹 What’s a Container Image?

A container image is like a blueprint.
From one image, you can create unlimited containers — each identical and consistent.


🔹 Why Did Nginx Show Up When I Typed localhost?

Because when you run:

docker run -d -p 80:80 nginx

You’re basically saying:

  • “Expose port 80 of my computer → connect it to port 80 inside the container.”

  • Your browser always looks at port 80 when you type localhost.

  • The request enters your Docker container.

  • Nginx returns its default welcome page.

Simple networking magic 🔥


⚡ Why Choose Containers Over VMs?

  • Faster startup — seconds, not minutes

  • No full operating system required

  • Cheaper

  • Cleaner for development teams

  • Easy to deploy on AWS, GCP, Azure


1. What is Docker?

Docker is a platform that lets you build, ship, and run applications inside containers.
It separates your application from the underlying infrastructure → giving faster development, consistent environments, and easy deployment.


2. The Docker Platform

Docker lets you package your application into a container—a lightweight, isolated environment that runs consistently everywhere.

With Docker, you can:

  • Develop using containers

  • Distribute applications as container images

  • Deploy the same container to dev, test, and production without differences


3. What Can You Use Docker For?

a) Fast, consistent delivery

  • Devs share code using containers

  • The same container goes to test → staging → production

  • CI/CD workflows become simple

  • No “works on my machine” problems

b) Responsive deployment & scaling

  • Containers run everywhere: laptop, datacenter, cloud

  • You can scale up/down in seconds

c) More workloads on the same hardware

  • Containers are lightweight → no OS overhead

  • Higher density than VMs

  • Cost-effective


4. Docker Architecture

Docker follows a client–server model.

a) Docker Daemon (dockerd)

  • Runs in the background

  • Handles images, containers, networks

  • Talks to other daemons

b) Docker Client (docker command)

  • You type docker run nginx

  • Client tells daemon → daemon executes it

  • Uses REST API

c) Docker Desktop

Includes:

  • Docker daemon

  • Docker CLI

  • Docker Compose

  • Kubernetes (optional)

d) Docker Registries

Where images are stored:

  • Docker Hub (default)

  • AWS ECR

  • Azure ACR

  • Google GCR

  • Private registries

e) Docker Objects

  • Images → templates

  • Containers → running instances of images

  • Networks

  • Volumes

  • Plugins


5. The Underlying Technology

Docker uses Linux namespaces & cgroups to create isolated environments.

  • Namespaces → isolation

  • Cgroups → resource limits

  • UnionFS → layers in images

  • Everything is written in Go


6. What Is a Container?

A container is:

  • An isolated process

  • With its own filesystem, binaries, libraries, config

  • Independent from the host machine

  • Portable across platforms

Containers vs VMs

ContainersVMs
Share host kernelFull OS & kernel
LightweightHeavy
Start in millisecondsStart in minutes
Perfect for microservicesGreat for OS-level isolation

7. What Is an Image?

An image is:

  • A read-only template

  • Contains binaries, app code, configs

  • Built using a Dockerfile

  • Made of multiple layers

Images are immutable.
Changes = new layers.

Examples

  • python:3.10

  • ubuntu:20.04

  • postgres:latest

  • Your custom image


8. Registries & Repositories

Registry

A service that stores images
Example: Docker Hub

Repository

A “folder” inside the registry with many versions


9. Docker Compose

Docker Compose = run multiple containers together using a single YAML file.

Why needed?

  • One container = one responsibility

  • Real apps need multiple services → frontend, backend, database, cache, queue

  • Compose manages all of them

Compose features

  • Start all services → docker compose up

  • Stop all → docker compose down

  • Networks auto-created

  • Volumes auto-created

  • Services isolated


10. Important Commands (Easy Summary)

Images

docker images
docker pull nginx
docker build -t myapp .
docker tag myapp myapp:v1
docker push myapp:v1

Containers

docker run -d -p 80:80 nginx
docker ps
docker stop container_id
docker rm container_id
docker logs container_id

Compose

docker compose up -d
docker compose down
docker compose down --volumes

11. Example: What Happens When You Run This?

docker run -it ubuntu /bin/bash

Steps:

  1. Pulls Ubuntu image

  2. Creates container

  3. Gives container a writable layer

  4. Creates network interface

  5. Starts container

  6. Opens /bin/bash inside it


12. Summary of Everything You Now Know

You now understand:

✔ Docker platform
✔ Containers
✔ Images
✔ Docker daemon/client
✔ Registries & repositories
✔ Docker Desktop
✔ Docker Compose
✔ Container vs VM
✔ How images are built
✔ How containers run
✔ How to push images to Docker Hub

This is literally the entire Docker Core Fundamentals — the complete thing.