The Power of Dev Containers and GitHub Codespaces

Chris Ayers

Chris Ayers

Senior Customer Engineer
Microsoft

Twitter: @Chris_L_Ayers
Mastodon: @Chrisayers@hachyderm.io
LinkedIn: - chris-l-ayers
Blog: https://chris-ayers.com/
GitHub: Codebytes

Agenda

  • Prerequisites
  • What are Dev Containers?
  • How Dev Containers Work?
  • Why use Dev Containers?
  • How to build a Dev Containers?

Prerequisites

DevContainers

  • VSCode with Dev Containers Extension
  • Docker
    • Docker Desktop 2+ - Windows/Mac
    • Linux - Docker CE/EE / Docker Compose 1.21+ - Not

GitHub Codespaces

  • GitHub Account
  • GitHub Codespaces

What are Dev Containers?

Dev Containers are:

  • Environments that run in a container
  • Containers that let you open or mount any folder and still use VS Code UI and tooling
  • Places to run Apps, Tools, or Runtimes needed for a project or codebase

Why use Dev Containers?

  • Onboard new People
  • Use consistent tooling
  • Use consistent versions
  • Reduce System Conflicts
  • Perform Startup Tasks

Inner and Outer Loops

fit

How Dev Containers Work

Dev Containers

How do you build a Dev Container?

From the Command Pallet

Add Dev Container files

Which Dev Container do I Pick?

Add Options

Templates

Full List: https://containers.dev/templates

  • Base (Alpine, Debian, Ubuntu)
  • Language Based (C#, C++, Java, Go, Node, Python, Rust, Ruby, PHP)
  • Tool Focused (Markdown, Kubernetes, Docker, Jekyll)

How Do I Configure it?

files

Customizations

  • Features
  • Extensions
  • Settings
  • Startup Tasks
  • Networking

Features

Full list here: https://containers.dev/features

  • CLIs (azure, gh, gcp, aws)
  • Tools (Terraform, kubernetes...)
  • Runtimes (Node, Python, Go, Java, .NET, PHP, Ruby, Rust, C/C++, C#)

GitHub Codespaces

  • Don't need to worry about Docker Desktop
  • VSCode, IntelliJ, Browser
  • 2 core machines up to 32 core machines
  • Default universal DevContainers
  • Codespaces only offers Linux as the OS and x86_64 as the Architecture

GitHub Codespaces

DEMO TIME

Resources