SynfraCore
Synfracore
Start Learning
Navigation

Academies

Platform

RoadmapsLabsCertificationsInterviewPYQsAI AssistantCareer
Start Learning Free🗺️ Learning Roadmaps

DockerOverview

What it is, why it matters, architecture and key concepts

✍️
Written by senior engineers. Reviewed for technical accuracy.· Updated 2025 · SynfraCore Docker Team
Expert Content

Docker — The Container Platform

Docker packages your application and all its dependencies into a container — a lightweight, portable, isolated unit that runs identically on any machine. No more "it works on my laptop."

ℹ️ What is a Container?

A container is not a virtual machine. It shares the host OS kernel but has its own isolated filesystem, process space, and network. This makes containers start in milliseconds and use 10-100× less memory than VMs.

How Docker Works

HOST MACHINE (Linux / macOS / Windows) Hardware (CPU · RAM · Disk · Network) Docker Engine (containerd + runc) Container A Node.js App node:20-alpine Port 3000 Container B Python API python:3.12-slim Port 8000 Container C PostgreSQL postgres:16-alpine Port 5432 isolated isolated isolated

VM vs Container

Virtual MachineDocker Container

|---|---|---|

**Start time**30 seconds – 5 minutesMilliseconds
SizeGB (full OS)MB (just app + deps)
IsolationFull hardware virtualizationOS kernel shared
Performance~10-20% overheadNear-native
Use caseFull OS neededApp packaging & scaling

The Docker Build Workflow

Dockerfile Instructions docker build Creates Image docker push Registry (DockerHub) docker run Running Container

Your First Dockerfile

dockerfile
# Start from official Node.js image
FROM node:20-alpine

# Set working directory inside container
WORKDIR /app

# Copy dependency files first (better layer caching)
COPY package*.json ./
RUN npm ci --only=production

# Copy source code
COPY . .

# Expose the port your app runs on
EXPOSE 3000

# Command to start the app
CMD ["node", "server.js"]

Essential Commands

bash
# Build an image from Dockerfile in current directory
docker build -t myapp:1.0 .

# Run a container
docker run -d -p 3000:3000 --name my-container myapp:1.0

# List running containers
docker ps

# View logs
docker logs -f my-container

# Stop and remove
docker stop my-container && docker rm my-container

# List images
docker images
💡 Key Concept: Images vs Containers

An Image is the blueprint (read-only). A Container is a running instance of an image. You can run many containers from one image — like a class and its objects in programming.

When to Use Docker

Consistent environments — dev, staging, prod all run identical software
Microservices — each service in its own container, independently deployable
CI/CD pipelines — build once, run anywhere
Local development — spin up databases, Redis, Kafka with one command
Kubernetes — all K8s workloads are containers
Share:
Join our Community
Daily tips, job alerts, interview help — join engineers learning together
Up Next
🔤
DockerFundamentals
Core concepts from scratch
Also Worth Exploring
← Back to all Docker modules
Prerequisites