quickstart6 min read

Getting Started with Docker and Kubernetes: Quick Start

SFEIR Institute

Key Takeaways

  • Docker multi-stage builds reduce image size from 200 MB to 50 MB for a Node.js application
  • Docker Desktop includes Kubernetes for simplified local deployment
  • '7 steps to deploy: Dockerfile, image, kubectl apply, Service'

Docker creates your containers. Kubernetes orchestrates them at scale. This guide allows you to deploy your first application in less than 15 minutes. According to the CNCF Annual Survey 2025, 82% of container users run Kubernetes in production. Mastering these two technologies becomes a fundamental skill for any DevOps professional.

TL;DR: Install Docker Desktop (includes Kubernetes), create an image with a Dockerfile, deploy it on your local cluster with kubectl apply. Result: a containerized application accessible in 7 steps.

To deepen these fundamentals, discover the Kubernetes Fundamentals training.

Why combine Docker and Kubernetes?

Docker is a containerization engine. It packages your code, its dependencies, and its configuration into a portable image. Kubernetes is an orchestrator. It deploys, scales, and supervises your containers on a cluster of machines.

Docker builds the blocks, Kubernetes assembles them.

ComponentRoleExample
DockerImage creationdocker build -t app:v1 .
KubernetesOrchestrationkubectl apply -f deployment.yaml
kubectlKubernetes CLICluster management
Minikube/KindLocal clusterDevelopment environment
Key takeaway: Docker and Kubernetes are not competitors. Docker produces containers, Kubernetes orchestrates them in production.

To understand these differences in detail, consult our article Kubernetes vs Docker: understanding the essential differences.

Technical prerequisites

Before starting your Docker Kubernetes getting started training, verify these elements:

Minimum hardware:

  • 8 GB RAM (16 GB recommended)
  • 20 GB free disk space
  • Processor with virtualization enabled (VT-x/AMD-V)

Required software:

  • macOS 12+, Windows 10/11 Pro, or Linux Ubuntu 20.04+
  • Terminal (zsh, bash, or PowerShell)
  • Code editor (VS Code recommended)

Accounts:

  • Docker Hub (free) to store your images

Step 1: Install Docker Desktop with Kubernetes

Docker Desktop integrates a single-node Kubernetes cluster. Download the installer from docker.com/products/docker-desktop.

# Verify Docker installation
docker --version
# Docker version 27.5.1, build 9f9e405

# Enable Kubernetes in Docker Desktop
# Settings → Kubernetes → Enable Kubernetes → Apply & Restart

# Verify Kubernetes cluster
kubectl version --client
# Client Version: v1.32.0

Enabling Kubernetes takes 2-3 minutes. Docker Desktop downloads the control plane components automatically.

Key takeaway: Docker Desktop provides a ready-to-use Kubernetes cluster. No complex configuration required to get started.

Step 2: Create a minimal Node.js application

Create a project folder and add these files:

mkdir k8s-quickstart && cd k8s-quickstart

File app.js:

const http = require('http');
const port = process.env.PORT || 3000;

const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
status: 'running',
hostname: process.env.HOSTNAME,
version: '1.0.0'
}));
});

server.listen(port, () => {
console.log(`Server running on port ${port}`);
});

File package.json:

{
"name": "k8s-quickstart",
"version": "1.0.0",
"main": "app.js",
"scripts": { "start": "node app.js" }
}

Step 3: Write an optimized Dockerfile

An efficient Dockerfile reduces image size and improves security. Alpine images are about 3 MB compared to 70 MB for Ubuntu (Medium Docker Optimization).

# File: Dockerfile
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production

FROM node:22-alpine
WORKDIR /app
RUN addgroup -g 1001 appgroup && adduser -u 1001 -G appgroup -s /bin/sh -D appuser
COPY --from=builder /app/node_modules ./node_modules
COPY app.js .
USER appuser
EXPOSE 3000
CMD ["node", "app.js"]

This multi-stage build separates build dependencies from runtime. Result: a 50 MB final image instead of 200 MB. To deepen these techniques, consult our guide Optimize a Dockerfile for Kubernetes: step by step guide.

Step 4: Build and test the Docker image

Build the image locally then test it:

# Build the image
docker build -t k8s-quickstart:v1 .

# Check the size
docker images k8s-quickstart:v1
# REPOSITORY      TAG   SIZE
# k8s-quickstart  v1    52MB

# Local test
docker run -d -p 3000:3000 --name test-app k8s-quickstart:v1

# Validate operation
curl http://localhost:3000
# {"status":"running","version":"1.0.0"}

# Clean up
docker stop test-app && docker rm test-app

The image works standalone. Let's move to Kubernetes deployment.

Step 5: Write Kubernetes manifests

Kubernetes uses YAML files to describe the desired state. Create a k8s.yaml file:

# File: k8s.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: quickstart-app
labels:
app: quickstart
spec:
replicas: 2
selector:
matchLabels:
app: quickstart
template:
metadata:
labels:
app: quickstart
spec:
containers:
- name: app
image: k8s-quickstart:v1
imagePullPolicy: Never  # Local image
ports:
- containerPort: 3000
resources:
requests:
memory: "64Mi"
cpu: "100m"
limits:
memory: "128Mi"
cpu: "200m"
---
apiVersion: v1
kind: Service
metadata:
name: quickstart-service
spec:
type: NodePort
selector:
app: quickstart
ports:
- port: 80
targetPort: 3000
nodePort: 30080

This manifest declares a Deployment with 2 replicas and a NodePort Service to expose the application.

Key takeaway: imagePullPolicy: Never tells Kubernetes to use the local Docker image. Essential for development without a registry.

Step 6: Deploy to Kubernetes

Apply the manifests and verify the deployment:

# Deploy the application
kubectl apply -f k8s.yaml

# Verify pods
kubectl get pods -l app=quickstart
# NAME                             READY   STATUS    AGE
# quickstart-app-7d4f8b6c9-abc12   1/1     Running   30s
# quickstart-app-7d4f8b6c9-def34   1/1     Running   30s

# Verify service
kubectl get svc quickstart-service
# NAME                 TYPE       PORT(S)
# quickstart-service   NodePort   80:30080/TCP

# Test the application
curl http://localhost:30080
# {"status":"running","hostname":"quickstart-app-7d4f8b6c9-abc12","version":"1.0.0"}

Kubernetes created 2 pods distributing the load. The hostname in the response changes depending on which pod responds.

Step 7: Scale and observe

Test Kubernetes elasticity:

# Scale to 5 replicas
kubectl scale deployment quickstart-app --replicas=5

# Observe scaling
kubectl get pods -l app=quickstart -w

# View logs from all pods
kubectl logs -l app=quickstart --tail=10

# Describe a pod for debugging
kubectl describe pod -l app=quickstart | head -50

# Clean up
kubectl delete -f k8s.yaml

This scale command illustrates Kubernetes power: going from 2 to 5 instances in seconds. To manage these operations in production, the LFS458 Kubernetes Administration training covers scaling, monitoring, and advanced troubleshooting.

Essential commands to remember

ActionCommand
List podskubectl get pods
View logskubectl logs
Enter a podkubectl exec -it -- sh
Apply a manifestkubectl apply -f
Delete resourceskubectl delete -f
Scale a deploymentkubectl scale deployment --replicas=N

Our Kubernetes Monitoring and Troubleshooting section details advanced debugging techniques.

What's next? Your training path

You've deployed your first application on Kubernetes. It's the starting point. As a TealHQ guide emphasizes: "Don't let your knowledge remain theoretical - set up a real Kubernetes environment to solidify your skills" (TealHQ).

Recommended next steps:

  1. Explore Containerization and Docker best practices to optimize your images
  2. Compare orchestrators in our Kubernetes vs Docker Swarm, ECS and Nomad comparison
  3. Read Docker Swarm to Kubernetes migration feedback from professionals
  4. Consult our Docker and Kubernetes FAQ to solve common problems

For a structured skill development, discover our Kubernetes Training: Complete Guide.

Take the next step

This Docker Kubernetes quick start tutorial allowed you to containerize and deploy an application in 15 minutes. To develop these skills toward certification:

Request your personalized quote to plan your Docker and Kubernetes training path.