🐳 Lesson 23 of 40 DevOps Intermediate

Docker & Dev Containers

Dev Containers let you define your entire development environment in code. VS Code opens your project inside a Docker container — giving every teammate an identical, reproducible setup.

57% complete

1Installing the Dev Containers Extension

Search for Dev Containers in Extensions (by Microsoft). You'll also need Docker Desktop (or Podman) installed and running on your machine.

2Adding a Dev Container to Your Project

Press Ctrl+Shift+PDev Containers: Add Dev Container Configuration Files. Choose a base image (e.g., Node.js 20) and VS Code generates a .devcontainer/devcontainer.json for you.

.devcontainer/devcontainer.json
{
  "name": "Node.js Dev",
  "image": "mcr.microsoft.com/devcontainers/node:20",
  "features": {
    "ghcr.io/devcontainers/features/git:1": {}
  },
  "postCreateCommand": "npm install"
}

3Opening Your Project in a Container

After adding the config, press Ctrl+Shift+PDev Containers: Reopen in Container. VS Code builds the image, starts the container, installs your extensions inside it, and reopens the window — all transparently.

4Docker Extension

The Docker extension (by Microsoft) adds a Docker Explorer to the Activity Bar. You can manage images, containers, volumes, networks, and registries without leaving VS Code. Right-click a container to attach a shell or open its logs.

5Custom Dockerfiles

For more control, point devcontainer.json at a Dockerfile or docker-compose.yml. This lets you install specific OS packages, set environment variables, and replicate your production environment exactly.

💡 Tip: Dev Containers work seamlessly with GitHub Codespaces — the same .devcontainer config file drives both your local container and your cloud-hosted Codespace.

All 40 Lessons
Pick any lesson to jump straight to it.
L01
Getting Started with VS Code
FoundationBeginner
L02
The VS Code Interface & Layout
FoundationBeginner
L03
Installing & Managing Extensions
ExtensionsBeginner
L04
Keyboard Shortcuts & Command Palette
ProductivityBeginner
L05
Settings, Themes & Customization
CustomizationBeginner
L06
IntelliSense & Code Completion
Editor FeaturesBeginner
L07
Integrated Terminal Mastery
ProductivityBeginner
L08
Search, Find & Replace Across Files
Editor FeaturesBeginner
L09
Git & Source Control with VS Code
Version ControlBeginner
L10
Snippets & Emmet Abbreviations
ProductivityBeginner
L11
GitHub Copilot — Getting Started
AI & CopilotIntermediate
L12
Copilot Chat & Inline Ask
AI & CopilotIntermediate
L13
JavaScript & TypeScript Development
LanguagesIntermediate
L14
Python Development in VS Code
LanguagesIntermediate
L15
Debugging Like a Pro
DebuggingIntermediate
L16
Linting, Formatting & ESLint
Code QualityIntermediate
L17
Multi-Cursor Editing & Refactoring
Editor FeaturesIntermediate
L18
Workspaces & Multi-Root Projects
WorkspaceIntermediate
L19
Tasks, Build Systems & npm Scripts
WorkflowIntermediate
L20
Testing with Jest, Vitest & Pytest
TestingIntermediate
L21
React Development Workflow
Web DevIntermediate
L22
Node.js & Express in VS Code
BackendIntermediate
L23
Docker & Dev Containers
DevOpsIntermediate
L24
Live Share — Real-Time Collaboration
CollaborationIntermediate
L25
Jupyter Notebooks in VS Code
Data ScienceIntermediate
L26
REST Client & API Testing
API DevIntermediate
L27
SSH Remote Development
Remote DevIntermediate
L28
WSL 2 Integration on Windows
Remote DevIntermediate
L29
Advanced Debugging: Breakpoints & Watch
DebuggingAdvanced
L30
Copilot Agent Mode — Agentic Workflows
AI & CopilotAdvanced
L31
Profile & Performance Optimisation
PerformanceAdvanced
L32
GitHub Actions & CI/CD Integration
DevOpsAdvanced
L33
Custom Keybindings & Key Maps
CustomizationAdvanced
L34
Settings Sync & Dotfiles Management
WorkflowAdvanced
L35
Language Server Protocol (LSP) Explained
InternalsAdvanced
L36
Rust Development in VS Code
LanguagesAdvanced
L37
Go Development in VS Code
LanguagesAdvanced
L38
GitHub Codespaces & vscode.dev
Remote DevExpert
L39
Writing Your First VS Code Extension
Extension DevExpert
L40
Pro VS Code Workflow & Mastery
MasteryExpert