How opencontainers/runc works
runc is a Linux OCI container runtime, commonly invoked by higher-level container software. Its main workflow takes a container bundle and lifecycle command, converts the OCI specification into runtime configuration, then creates and starts a container with namespaces, a prepared root filesystem, resource controls, and security settings. The README establishes the product and bundle workflow; sampled source and the SOURCE INDEX support several internal relationships. Many command-handler and lifecycle details are unsampled, so those links are marked unverified rather than treated as inspected call paths.
Main entry points: container_linux.go Container lifecycle · process_linux.go Process launch · config.go Runtime config · main.go runc CLI
Components 18
CLI and OCI
- runc CLI
main.go - OCI bundle
- Spec conversion
libcontainer/specconv/spec_linux.go - Config validation
libcontainer/configs/validate/validator.go - Runtime config
libcontainer/configs/config.go
Container lifecycle
- Container lifecycle
libcontainer/container_linux.go - Process launch
libcontainer/process_linux.go - Checkpoint and restore
libcontainer/criu_linux.go
Isolation and security
- Namespace bootstrap
libcontainer/nsenter/nsexec.c - Root filesystem
libcontainer/rootfs_linux.go - Capabilities
libcontainer/capabilities/capabilities.go - AppArmor
libcontainer/apparmor/apparmor_linux.go - Seccomp filters
libcontainer/seccomp/seccomp_linux.go
Resource management
- Cgroup controls
libcontainer/process_linux.go - Container networking
libcontainer/process_linux.go - Intel RDT
libcontainer/intelrdt/intelrdt.go - Runtime statistics
libcontainer/stats_linux.go
Other components
- Runtime caller
Connections 18
- Runtime caller → runc CLI: invokes
- OCI bundle → runc CLI: supplies config
- runc CLI → Spec conversion: converts spec
- Spec conversion → Runtime config: builds config
libcontainer/specconv/spec_linux.go - Config validation → Runtime config: validates
libcontainer/configs/validate/validator.go - Container lifecycle → Process launch: starts process
- Process launch → Runtime config: uses settings
libcontainer/process_linux.go - Process launch → Cgroup controls: adds process
libcontainer/process_linux.go - Process launch → Container networking: sets up
libcontainer/process_linux.go - Process launch → Intel RDT: manages
libcontainer/process_linux.go - Container lifecycle → Root filesystem: prepares rootfs
- Root filesystem → Runtime config: reads mounts
libcontainer/rootfs_linux.go - Process launch → Namespace bootstrap: launches via
- Container lifecycle → Capabilities: applies
- Container lifecycle → AppArmor: configures
- Container lifecycle → Seccomp filters: configures
- Container lifecycle → Checkpoint and restore: checkpoints
- Container lifecycle → Runtime statistics: reports stats