CNI Specification

The CNI specification defines the interface between container runtimes and network plugins. It specifies how runtimes invoke plugins via environment variables (CNI_COMMAND, CNI_CONTAINERID, CNI_NETNS, CNI_IFNAME, CNI_PATH, CNI_ARGS) and stdin configuration, and how plugins respond on stdout with network interface details. The spec covers ADD, DEL, CHECK, and VERSION operations for managing container network attachments, and defines the plugin chaining model used by meta-plugins.

API entry from apis.yml

apis.yml Raw ↑
aid: cni:cni-spec
name: CNI Specification
description: The CNI specification defines the interface between container runtimes and network plugins.
  It specifies how runtimes invoke plugins via environment variables (CNI_COMMAND, CNI_CONTAINERID, CNI_NETNS,
  CNI_IFNAME, CNI_PATH, CNI_ARGS) and stdin configuration, and how plugins respond on stdout with network
  interface details. The spec covers ADD, DEL, CHECK, and VERSION operations for managing container network
  attachments, and defines the plugin chaining model used by meta-plugins.
humanURL: https://www.cni.dev/docs/spec/
properties:
- type: Documentation
  url: https://www.cni.dev/docs/spec/
- type: GitHubRepository
  url: https://github.com/containernetworking/cni
- type: JSONSchema
  url: json-schema/cni-network-config-schema.json
- type: JSONSchema
  url: json-schema/cni-result-schema.json
- type: JSONLDContext
  url: json-ld/cni-context.jsonld
- type: NaftikoCapabilities
  url: capabilities/cni-spec-capabilities.yml
tags:
- Network Plugins
- Specification
x-features:
- name: ADD operation
  description: Attach a container to a network and return a Result document with assigned interfaces,
    IPs, routes, and DNS.
- name: DEL operation
  description: Detach a container from a network and tear down allocated resources.
- name: CHECK operation
  description: Verify the container's current attachment matches the prior ADD result.
- name: VERSION operation
  description: Report the CNI spec versions a plugin supports.
- name: Plugin Chaining
  description: Meta-plugin chaining model where a chain shares previous Result via prevResult.
- name: Network Config Schema
  description: Schema for the JSON document that describes a network and its plugin chain.
- name: Result Schema
  description: Schema for the Result document that plugins emit on stdout.
x-useCases:
- name: Kubernetes CNI Plugin
  description: Implement a CNI plugin that integrates with Kubernetes / containerd / CRI-O.
- name: Network Validation
  description: Validate network configurations and plugin Result documents against the spec.
- name: Custom SDN
  description: Build custom software-defined networks for containers using a portable plugin contract.