Open Container Initiative

出典: フリー百科事典『ウィキペディア(Wikipedia)』

Open Container InitiativeOCI)は、OSレベル仮想化英語版の一種である「コンテナ」のフォーマット・ランタイムの業界標準策定を目的として設立されたイニシアチブである[1]Linux Foundationプロジェクトの1つである[2]

概要[編集]

OSレベル仮想化手法の1つとして、Dockerをはじめとするコンテナ仮想化技術がある。複数存在するコンテナ仮想化実装のオープン業界標準策定を目的として設立されたのがOpen Container Initiativeである。

OCIが策定した標準仕様は以下の2つである[3]

またOCIは上記仕様のリファレンス実装であるrunCを開発しており[4]、これは高レベルのツールを開発する際のベースとなっている。

OCI Runtime Spec[編集]

Container[編集]

OCI RuntimeにおけるContainerは「『隔離とリソース制限を設定可能なプロセス実行』を提供する1つの環境」である[5]。例えばruncランタイム上で生成されたContainerは他のコンテナからファイルシステムやプロセスが隔離され、利用可能なCPUリソース等に制限がかけられている。ゆえにこのコンテナ(環境)内で実行されるプロセスは隔離とリソース制限を得ることができる。

OCI Runtime SpecではこのContainerのライフサイクル等を定義している。

status[編集]

OCI Containerはcreating, created, running, stopped以下のいずれかの状態あるいはランタイムが拡張した状態にある[6]

Runtime[編集]

OCIにおけるRuntimeはContainerの管理を司るプログラムである。Runtimeはbundleから設定ファイルを読み込み、それに基づいてコンテナを生成、コンテナ内でプロセスを起動し、その他のコンテナライフサイクル管理を実行する[7]

OCI Runtime Specに準拠した様々なコンテナランタイムが実装されている。

  • runc: 広く利用されているリファレンス実装。containerd[8](を利用するDocker[9])やcri-o[10]のランタイムとして利用されている
  • kata-runtime: 軽量VMで高い安全性を志向するKata Containers[11]のランタイム[12]
  • runsc: 高い安全性を志向するgVisorのランタイム[13]

他にも様々なランタイムが開発された。

  • RailCar: Rustで実装されたOCI Runtime実装 (開発終了)

filesystem bundle[編集]

OCIにおける filesystem bundle は、コンテナに必要な全ファイルが定められた形式で配置された1つのセットである[14]。bundleは設定情報を含むconfig.jsonおよびコンテナのrootファイルシステムから成る。Runtimeはコンテナidとfilesystem bundleからコンテナを生成する[15]

OCI Image[編集]

OCI ImageOCI Image Format Specificationによって定義されるコンテナイメージ仕様である[16]。OCI Imageにはディレクトリ/ファイル情報と実行時設定が含まれており[17]、OCI Imageに準拠したコンテナイメージをOCI Runtimeに準拠したコンテナランタイムへ渡すことでコンテナを実行できる[18]

OCI Imageは以下の4要素で構成される[19]

  • Manifest: コンテナイメージに含まれるlayersとconfigurationのハッシュ値等が記述されたJSONファイル[20]
  • image index (任意)
  • set of filesystem layers: ファイルシステムのchangesets (tar, tar.gz, tar.zstdとメタデータ)
  • Configuration: アプリケーションの引数、環境変数等の設定情報が記述されたJSONファイル[21]

OCI Imageはファイルシステム情報をそのまま持つのではなく、changesetつまり元ファイルシステムに対する変更差分を用いて保有している(c.f. Git)。これにより元ファイルシステムにすべての変更履歴(layers)を適用することで完全なファイルシステムを生成できるようになっている。

OCI Runtimeでは、OCI Image layersから得られたファイルシステム実体とImage Configurationの変換で得られたconfig.jsonからfilesystem bundleを得ることでコンテナを生成する[16](image → bunble → container)。

脚注[編集]

  1. ^ for the express purpose of creating open industry standards around container formats and runtime. [1]
  2. ^ formed under the auspices of the Linux Foundation [2]
  3. ^ The OCI currently contains two specifications: the Runtime Specification (runtime-spec) and the Image Specification (image-spec). [3]
  4. ^ Open Container Initiative. “opencontainers/runc: CLI tool for spawning and running containers according to the OCI specification”. GitHub. 2019年6月14日閲覧。
  5. ^ An environment for executing processes with configurable isolation and resource limitations. OCI Runtime Spec
  6. ^ The state of a container includes the following properties... (中略) ...status (string, REQUIRED) is the runtime state of the container. The value MAY be one of: OCI Runtime Spec
  7. ^ It reads the configuration files from a bundle, uses that information to create a container, launches a process inside the container, and performs other lifecycle actions. OCI Runtime Spec
  8. ^ containerd is built with OCI support and with support for advanced features provided by runc. [4]
  9. ^ By default, the Docker daemon automatically starts containerd[5]
  10. ^ CRI-O then launches an OCI Compatible Runtime using the specification to run the container proceses. The default OCI Runtime is runc. [6]
  11. ^ Kata Containers is an open source community working to build a secure container runtime with lightweight virtual machines [7]
  12. ^ kata-runtime, referred to as "the runtime" ...(ry)... The runtime is OCI-compatible, CRI-O-compatible, and Containerd-compatible, allowing it to work seamlessly with both Docker and Kubernetes respectively. [8]
  13. ^ It includes an Open Container Initiative (OCI) runtime called runsc that provides an isolation boundary between the application and the host kernel. [9]
  14. ^ a filesystem bundle - a set of files organized in a certain way, and containing all the necessary data and metadata for any compliant runtime to perform all standard operations against it. OCI Runtime Spec
  15. ^ OCI compliant runtime's create command is invoked with a reference to the location of the bundle and a unique identifier. OCI Runtime Spec
  16. ^ This specification defines an OCI Image [10]
  17. ^ An OCI Image is an ordered collection of root filesystem changes and the corresponding execution parameters for use within a container runtime. [11]
  18. ^ an OCI implementation would download an OCI Image then unpack that image into an OCI Runtime filesystem bundle. At this point the OCI Runtime Bundle would be run by an OCI Runtime. [12]
  19. ^ consisting of a manifest, an image index (optional), a set of filesystem layers, and a configuration. [13]
  20. ^ an image manifest provides a configuration and set of layers for a single container image for a specific architecture and operating system. [14]
  21. ^ The image configuration includes information such as application arguments, environments, etc. [15]

外部リンク[編集]