my-bundle/
├── config.json
└── rootfs/ ├── bin/ ├── lib/ └── ...
my-bundle/
├── config.json
└── rootfs/ ├── bin/ ├── lib/ └── ...
my-bundle/
├── config.json
└── rootfs/ ├── bin/ ├── lib/ └── ...
{ "ociVersion": "1.0.1", "process": { "terminal": true, "user": { "uid": 1, "gid": 1, "additionalGids": [ 5, 6 ] }, "args": [ "sh" ], "env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm" ], "cwd": "/", }, "root": { "path": "rootfs", "readonly": true }, "hostname": "slartibartfast", "hooks": { "prestart": [ { "path": "/usr/bin/fix-mounts", "args": [ "fix-mounts", "arg1", "arg2" ], "env": [ "key1=value1" ] }, { "path": "/usr/bin/setup-network" } ], "poststart": [ { "path": "/usr/bin/notify-start", "timeout": 5 } ], "poststop": [ { "path": "/usr/sbin/cleanup.sh", "args": [ "cleanup.sh", "-f" ] } ] }, // other fields too
}
{ "ociVersion": "1.0.1", "process": { "terminal": true, "user": { "uid": 1, "gid": 1, "additionalGids": [ 5, 6 ] }, "args": [ "sh" ], "env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm" ], "cwd": "/", }, "root": { "path": "rootfs", "readonly": true }, "hostname": "slartibartfast", "hooks": { "prestart": [ { "path": "/usr/bin/fix-mounts", "args": [ "fix-mounts", "arg1", "arg2" ], "env": [ "key1=value1" ] }, { "path": "/usr/bin/setup-network" } ], "poststart": [ { "path": "/usr/bin/notify-start", "timeout": 5 } ], "poststop": [ { "path": "/usr/sbin/cleanup.sh", "args": [ "cleanup.sh", "-f" ] } ] }, // other fields too
}
{ "ociVersion": "1.0.1", "process": { "terminal": true, "user": { "uid": 1, "gid": 1, "additionalGids": [ 5, 6 ] }, "args": [ "sh" ], "env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm" ], "cwd": "/", }, "root": { "path": "rootfs", "readonly": true }, "hostname": "slartibartfast", "hooks": { "prestart": [ { "path": "/usr/bin/fix-mounts", "args": [ "fix-mounts", "arg1", "arg2" ], "env": [ "key1=value1" ] }, { "path": "/usr/bin/setup-network" } ], "poststart": [ { "path": "/usr/bin/notify-start", "timeout": 5 } ], "poststop": [ { "path": "/usr/sbin/cleanup.sh", "args": [ "cleanup.sh", "-f" ] } ] }, // other fields too
}
{ "ociVersion": "0.2.0", // the OCI spec version "id": "oci-container1", // this has to be unique across containers "status": "running", // it can be either creating, created, running, stopped "pid": 4422, // the process ID "bundle": "/containers/redis", // the path to the bundle "annotations": { // extra annotations "myKey": "myValue" }
}
{ "ociVersion": "0.2.0", // the OCI spec version "id": "oci-container1", // this has to be unique across containers "status": "running", // it can be either creating, created, running, stopped "pid": 4422, // the process ID "bundle": "/containers/redis", // the path to the bundle "annotations": { // extra annotations "myKey": "myValue" }
}
{ "ociVersion": "0.2.0", // the OCI spec version "id": "oci-container1", // this has to be unique across containers "status": "running", // it can be either creating, created, running, stopped "pid": 4422, // the process ID "bundle": "/containers/redis", // the path to the bundle "annotations": { // extra annotations "myKey": "myValue" }
}
Client (ctr / nerdctl / Kubernetes): The client you interact with ↓
containerd: The High level manager or container runtime daemon ↓
containerd-shim: runtime shim ↓
runc: OCI runtime
Client (ctr / nerdctl / Kubernetes): The client you interact with ↓
containerd: The High level manager or container runtime daemon ↓
containerd-shim: runtime shim ↓
runc: OCI runtime
Client (ctr / nerdctl / Kubernetes): The client you interact with ↓
containerd: The High level manager or container runtime daemon ↓
containerd-shim: runtime shim ↓
runc: OCI runtime - runc: The most popular runtime which was originally donated by Docker to serve as the industry's reference standard
- Kata Containers: Uses lightweight VMs for stronger isolation.
- gVisor: Provides a sandboxed kernel for enhanced security
- urunc: Another early stage OCI runtime that allows you to run unikernels as containers. - Specification version - OCI compliant runtime's create command is invoked with a reference to the location of the bundle and a unique identifier.
- The container's runtime environment MUST be created according to the configuration in config.json.
If the runtime is unable to create the environment specified in the config.json, it MUST generate an error.
While the resources requested in the config.json MUST be created, the user-specified program (from process) MUST NOT be run at this time.
Any updates to config.json after this step MUST NOT affect the container.
- The prestart hooks MUST be invoked by the runtime.
If any prestart hook fails, the runtime MUST generate an error, stop the container, and continue the lifecycle at step 12.
- The createRuntime hooks MUST be invoked by the runtime.
If any createRuntime hook fails, the runtime MUST generate an error, stop the container, and continue the lifecycle at step 12.
- The createContainer hooks MUST be invoked by the runtime.
If any createContainer hook fails, the runtime MUST generate an error, stop the container, and continue the lifecycle at step 12.
- Runtime's start command is invoked with the unique identifier of the container.
- The startContainer hooks MUST be invoked by the runtime.
If any startContainer hook fails, the runtime MUST generate an error, stop the container, and continue the lifecycle at step 12.
- The runtime MUST run the user-specified program, as specified by process.
- The poststart hooks MUST be invoked by the runtime.
If any poststart hook fails, the runtime MUST generate an error, stop the container, and continue the lifecycle at step 12.
- The container process exits.
This MAY happen due to erroring out, exiting, crashing or the runtime's kill operation being invoked.
- Runtime's delete command is invoked with the unique identifier of the container.
- The container MUST be destroyed by undoing the steps performed during create phase (step 2).
- The poststop hooks MUST be invoked by the runtime.
If any poststop hook fails, the runtime MUST log a warning, but the remaining hooks and lifecycle continue as if the hook had succeeded. - Docker / nerdctl / Kubernetes → user-facing tools
- containerd → high-level container manager
- OCI Runtime (runc, crun, kata) → low-level runtime that actually creates containers
- OCI Runtime Specification → the standard runtimes must follow - image pulling/unpacking
- snapshots/filesystems
- container metadata
- lifecycle management
- networking integration hooks
- task supervision
- CRI integration for Kubernetes - Launching OCI runtime binaries, i.e calling the create/start/delete container commands.
- Reconnecting containers after daemon restart
- Reporting events, state and metrics
- Supervising Containers
- managing stdio pipes
- process reaping
- checkpoint coordination