How microsoft/hcsshim works
Project Type and Purpose
• This is primarily a Go “library + CLI” project providing:
• A Go interface to the Windows Host Compute Service (HCS) and Host Network Service (HNS)
• A Containerd Runtime V2 shim (containerd-shim-runhcs-v1 / runhcs) for Windows containers
• A Linux Hyper-V container guest agent (cmd/gcs) and side-car
• Supporting utilities (wclayer, computestorage, ext4/tar2ext4, ncproxy, shimdiag, etc.)
• It’s consumed by container runtimes (e.g., Moby, containerd) to launch/manage Windows & Linux-in-VM containers.
File Structure
• Top-level cmd/… folders: the various CLI binaries
• internal/… packages: host-side libraries for HCS, HNS, UVM, guest bridge, storage, networking, security, logging, etc.
• pkg/…: externally consumable Go packages (e.g., go-runhcs, ncproxy gRPC proxies, securitypolicy)
• ext4/, computestorage/: file-system tooling for Linux containers
• scripts/, Makefile: build/test pipelines
• test/: integration & unit tests
README Insights
• Describes two main binaries:
• cmd/containerd-shim-runhcs-v1 (Windows shim for containerd Runtime V2 API)
• cmd/gcs (Linux guest agent)
• Mentions Go interfaces for HCS and HNS, and integration points into containerd and Moby.
Detail Level
• Core flows—container lifecycle, network setup, filesystem provisioning, guest signaling
• Avoid diving into every internal package; instead, show representative modules by capability (compute, network, storage, guest bridge)
• Important extension points: pkg/go-runhcs, pkg/ncproxy, pkg/securitypolicy