CoachnestCoachnest
For OrganizationsSign InGet Started
Back to course

DevOps Essentials: Docker to Kubernetes

…
—
Contents

Container Fundamentals

Reading12mFree
2

Docker in Practice — Compose & Networking

Video35m
3

Docker Assessment

Quiz15m
4

Lesson 10

Reading
5

Kubernetes Architecture & Core Concepts

Reading20m
6

Deploying a Full-Stack App on Kubernetes

Video40m
7

DevOps Final Assessment

Quiz20m
←→navigate lessons
Chapter 1 of 2·Docker Fundamentals
Lesson 1 of 7Reading12 min

Container Fundamentals

#Container Fundamentals¶

Before Docker, deploying software was painful. "It works on my machine" was a running joke — and a real problem. Containers solve this once and for all.

Virtual Machines vs Containers¶

FeatureVirtual MachineContainer
Startup time30–120 seconds< 1 second
SizeGBsMBs
OS overheadFull OS per VMShares host OS kernel
IsolationHardware-levelProcess-level
PortabilityGood (OVF format)Excellent (Docker Hub)

What is a Container?¶

A container is a standardised, isolated process that packages:

  • The application code
  • Runtime (Python, Node, JVM, etc.)
  • System libraries & dependencies
  • Configuration files

The same container image runs identically on:

  • Your laptop (macOS, Windows, Linux)
  • A CI/CD runner
  • A production server in any cloud

Docker Architecture¶

┌─────────────────────────────────────────┐ │ Your Machine │ │ ┌─────────────┐ ┌──────────────────┐ │ │ │ Docker CLI │──▶│ Docker Daemon │ │ │ └─────────────┘ │ (dockerd) │ │ │ └────────┬─────────┘ │ │ │ │ │ ┌──────────────────┼──────┐ │ │ │ Containers │ │ │ │ │ ┌───────┐ ┌───────┐ │ │ │ │ │ App A │ │ App B │ │ │ │ │ └───────┘ └───────┘ │ │ │ └──────────────────────────┘ │ └─────────────────────────────────────────┘

Your First Container¶

bash
11 lines
1# Pull and run an nginx web server
2docker run -d -p 8080:80 --name my-nginx nginx
3
4# Visit http://localhost:8080 to see it running
5
6# List running containers
7docker ps
8
9# Stop & remove
10docker stop my-nginx
11docker rm my-nginx

The Dockerfile¶

A Dockerfile is the blueprint for your container image:

dockerfile
18 lines
1# Start from an official Node.js image
2FROM node:20-alpine
3
4# Set the working directory
5WORKDIR /app
6
7# Copy and install dependencies first (for layer caching)
8COPY package*.json ./
9RUN npm ci --only=production
10
11# Copy app code
12COPY . .
13
14# Expose the port your app listens on
15EXPOSE 3000
16
17# Start the app
18CMD ["node", "server.js"]
bash
5 lines
1# Build the image
2docker build -t my-app:1.0 .
3
4# Run it
5docker run -p 3000:3000 my-app:1.0

Understanding these basics unlocks the entire DevOps ecosystem. Let's go deeper! 🐳

Back to

Course Overview

Next

Docker in Practice — Compose & Networking

Use ← → arrow keys to navigate between lessons