Skills2026年5月9日·1 分钟阅读

runc — Industry-Standard OCI Container Runtime

The reference implementation of the OCI runtime specification, runc spawns and manages containers at the lowest level for Docker, containerd, Podman, and CRI-O.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
runc Overview
通用 CLI 安装命令
npx tokrepo install 67dfd682-4b7f-11f1-9bc6-00163e2b0d79

Introduction

runc is a lightweight CLI tool for spawning and running containers according to the Open Container Initiative (OCI) specification. Originally extracted from Docker, it serves as the foundational runtime beneath higher-level tools like containerd and CRI-O.

What runc Does

  • Creates and runs OCI-compliant containers from a bundle (rootfs + config.json)
  • Manages container lifecycle: create, start, pause, resume, kill, delete
  • Applies Linux namespaces, cgroups, seccomp, and AppArmor policies
  • Supports rootless containers for unprivileged users
  • Provides checkpoint and restore via CRIU integration

Architecture Overview

runc operates directly on Linux kernel primitives. Given an OCI bundle directory containing a root filesystem and a config.json specification, it forks a process, sets up the requested namespaces (pid, net, mnt, user, uts, ipc, cgroup), configures cgroup resource limits, applies seccomp filters, pivots into the rootfs, and executes the specified entrypoint. It exits once the container process completes.

Self-Hosting & Configuration

  • Install via distro packages, static binaries from GitHub releases, or build with Go
  • Create OCI bundles manually or via tools like umoci and skopeo
  • Edit config.json to tune namespaces, capabilities, mounts, and resource limits
  • Enable rootless mode by setting uid/gid mappings in the user namespace config
  • Integrate with containerd or CRI-O as the low-level runtime backend

Key Features

  • Reference implementation of the OCI Runtime Specification
  • Minimal footprint: single static binary with no daemon
  • Rootless container support without requiring root privileges
  • CRIU-based checkpoint/restore for live container migration
  • Battle-tested foundation powering Docker, Kubernetes, and most container platforms

Comparison with Similar Tools

  • crun — C-based OCI runtime optimized for speed and low memory; runc is the Go reference implementation
  • youki — Rust-based OCI runtime focusing on safety; runc has broader adoption
  • gVisor (runsc) — sandboxed runtime with a user-space kernel; runc uses native Linux namespaces
  • Kata Containers — runs each container in a lightweight VM; runc shares the host kernel
  • containerd — a higher-level daemon that manages images and calls runc to run containers

FAQ

Q: Is runc the same as Docker? A: No. runc is the low-level runtime that Docker (via containerd) uses to actually create containers. Docker adds image management, networking, and a CLI on top.

Q: Can I use runc directly in production? A: You can, but most production setups use containerd or CRI-O as a management layer that orchestrates runc under the hood.

Q: Does runc work on macOS or Windows? A: runc requires Linux kernel features (namespaces, cgroups). On macOS and Windows, container tools run runc inside a Linux VM.

Q: What is rootless mode? A: Rootless mode lets unprivileged users run containers by leveraging user namespaces, removing the need for root or setuid binaries.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产