<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>OCI on 断念梦的站点</title><link>https://desistdaydream.github.io/docs/10.%E4%BA%91%E5%8E%9F%E7%94%9F/Containerization/OCI/</link><description>Recent content in OCI on 断念梦的站点</description><generator>Hugo</generator><language>zh-cn</language><atom:link href="https://desistdaydream.github.io/docs/10.%E4%BA%91%E5%8E%9F%E7%94%9F/Containerization/OCI/index.xml" rel="self" type="application/rss+xml"/><item><title>OCI</title><link>https://desistdaydream.github.io/docs/10.%E4%BA%91%E5%8E%9F%E7%94%9F/Containerization/OCI/OCI/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://desistdaydream.github.io/docs/10.%E4%BA%91%E5%8E%9F%E7%94%9F/Containerization/OCI/OCI/</guid><description>&lt;h1 id="概述"&gt;概述&lt;a class="td-heading-self-link" href="#%e6%a6%82%e8%bf%b0" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;参考：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://opencontainers.org/"&gt;OCI 官网&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers"&gt;GitHub 组织，OpenContainers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://segmentfault.com/u/public0821/articles"&gt;segmentfault，《走进 docker》系列文章&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Open Containers Initiative(开放容器倡议，简称 OCI)&lt;/strong&gt; 是一个轻量级的，开放的治理结构（项目），由 Linux Foundation 主持成立，其明确目的是围绕 Container 镜像格式和运行时创建开放的行业标准。OCI 由 Docker，CoreOS 和其他容器行业领导者于 2015 年 6 月 22 日启动。&lt;/p&gt;
&lt;p&gt;OCI 公有如下几个个规范：&lt;/p&gt;
&lt;p&gt;一开始有两个&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Image-spec(镜像规范)&lt;/strong&gt; # 容器镜像所包含的内容以及格式都遵循统一的格式标准，由 OCI 负责维护
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://desistdaydream.github.io/docs/10.%E4%BA%91%E5%8E%9F%E7%94%9F/Containerization/OCI/OCI-Image-%E8%A7%84%E8%8C%83/"&gt;OCI Image 规范&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Runtime-spec(运行时规范)&lt;/strong&gt; # 容器运行时的内容以及格式都遵循统一的格式标准，由 OCI 负责维护
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://desistdaydream.github.io/docs/10.%E4%BA%91%E5%8E%9F%E7%94%9F/Containerization/OCI/OCI-Runtime-%E8%A7%84%E8%8C%83/"&gt;OCI Runtime 规范&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;后来新加的一个&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Distribution-spec(分发规范)&lt;/strong&gt; #&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;在所有企业、各人在构建镜像、运行容器时，都应该遵守 OCI 标准，比如想用 docker 工具构建一个镜像，那么构建出来的镜像规范，必须符合 OCI 标准。其他类似 docker 的工具同理。如果想自己开发一个构建镜像的工具或者运行容器的运行时，都需要符合 OCI 的标准。这样大家都遵守同一套规范，才有利于技术的发展。&lt;/p&gt;</description></item><item><title>OCI Image 规范</title><link>https://desistdaydream.github.io/docs/10.%E4%BA%91%E5%8E%9F%E7%94%9F/Containerization/OCI/OCI-Image-%E8%A7%84%E8%8C%83/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://desistdaydream.github.io/docs/10.%E4%BA%91%E5%8E%9F%E7%94%9F/Containerization/OCI/OCI-Image-%E8%A7%84%E8%8C%83/</guid><description>&lt;h1 id="概述"&gt;概述&lt;a class="td-heading-self-link" href="#%e6%a6%82%e8%bf%b0" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;参考：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/image-spec/blob/main/spec.md"&gt;GitHub 项目，opencontainers/image-spec/spec.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://segmentfault.com/a/1190000009309347"&gt;思否大佬&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mp.weixin.qq.com/s/8wAv87DkJjE6fVEEmoQ60Q"&gt;https://mp.weixin.qq.com/s/8wAv87DkJjE6fVEEmoQ60Q&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.k8s.li/Exploring-container-image.html"&gt;https://blog.k8s.li/Exploring-container-image.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;OCI Image 规范的目的，是为了让其他人按照规范创建交互工具，这个工具应该可以 &lt;strong&gt;building(构建)&lt;/strong&gt;、&lt;strong&gt;transporting(传输)&lt;/strong&gt;、&lt;strong&gt;running(运行)&lt;/strong&gt; 一个容器镜像。&lt;/p&gt;
&lt;p&gt;一个 OCI Image 应该由一个 Image Manifest、一个 Image Index(可选)、一组文件系统层、一个配置文件 组成。&lt;/p&gt;
&lt;p&gt;本质上，镜像的每一层就是一个一个的 tar.gz 的文件，当各种容器工具 pull 镜像时，会根据各种元数据文件，获取到这些 tar.gz 文件，下载到本地，并根据自身的实现解压他们。&lt;/p&gt;
&lt;h2 id="oci-image-规范的组件"&gt;OCI Image 规范的组件&lt;a class="td-heading-self-link" href="#oci-image-%e8%a7%84%e8%8c%83%e7%9a%84%e7%bb%84%e4%bb%b6" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;前文所描述的组成 OCI Image 规范的多个组成部分，又被细分为如下 &lt;strong&gt;Components(组件)&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/image-spec/blob/master/image-layout.md"&gt;Image Layout&lt;/a&gt; # 镜像内容的文件系统布局。说白了，镜像的主要内容就在这里。
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/image-spec/blob/master/manifest.md"&gt;Image Manifest&lt;/a&gt; # 描述构成容器镜像所具有的组件的文件。比如这个镜像有哪些 layer，额外的 annotation 信息。manifest 文件中保存了很多和当前平台有关的信息&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/image-spec/blob/master/config.md"&gt;Image Configuration&lt;/a&gt; # 一个文档，该文档确定适用于转换为 &lt;a href="https://github.com/opencontainers/runtime-spec"&gt;runtime bundle&lt;/a&gt; 运行时包的映像的层顺序和配置。保存了文件系统的层级信息（每个层级的 hash 值，以及历史信息），以及容器运行时需要的一些信息（比如环境变量、工作目录、命令参数、mount 列表），指定了镜像在某个特定平台和系统的配置。比较接近我们使用 docker inspect   看到的内容&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/image-spec/blob/master/image-index.md"&gt;Image Index&lt;/a&gt; # 带注释的图像清单索引。指向不同平台的 manifest 文件，这个文件能保证一个镜像可以跨平台使用，每个平台拥有不同的 manifest 文件，使用 index 作为索引&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/image-spec/blob/main/layer.md"&gt;Filesystem Layer changeset&lt;/a&gt; # 描述容器文件系统的变更集。以 layer 保存的文件系统，每个 layer 保存了和上层之间变化的部分，layer 应该保存哪些文件，怎么表示增加、修改和删除的文件等&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/image-spec/blob/master/conversion.md"&gt;Conversion&lt;/a&gt; # 描述此翻译应如何发生。a document describing how this translation should occur&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/image-spec/blob/master/descriptor.md"&gt;Descriptor&lt;/a&gt; # 描述所引用内容的类型，元数据和内容地址的引用。a reference that describes the type, metadata and content address of referenced content&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Future versions of this specification may include the following OPTIONAL features:&lt;/p&gt;</description></item><item><title>OCI Runtime 规范</title><link>https://desistdaydream.github.io/docs/10.%E4%BA%91%E5%8E%9F%E7%94%9F/Containerization/OCI/OCI-Runtime-%E8%A7%84%E8%8C%83/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://desistdaydream.github.io/docs/10.%E4%BA%91%E5%8E%9F%E7%94%9F/Containerization/OCI/OCI-Runtime-%E8%A7%84%E8%8C%83/</guid><description>&lt;h1 id="概述"&gt;概述&lt;a class="td-heading-self-link" href="#%e6%a6%82%e8%bf%b0" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;参考：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/runtime-spec/blob/main/spec.md"&gt;GitHub 项目，opencontainers/runtime-spec/spec.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/runtime-tools"&gt;GitHub 项目，opencontainers/runtime-tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://segmentfault.com/a/1190000009583199"&gt;思否大佬&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;OCI Runtime 规范用来指定一个 Container 的配置、执行环境和生命周期。&lt;/p&gt;
&lt;p&gt;容器的配置被指定为 config.json ，并详细说明了可以创建容器的字段。指定执行环境是为了确保容器内运行的应用程序在运行时之间具有一致的环境，以及为容器的生命周期定义的常见操作。&lt;/p&gt;
&lt;p&gt;由于容器运行起来，需要一个运行环境，比如是运行在 linux 上、还是 windows 上；所以，OCI Runtime 标准，会根据不同的平台，制定不同的规范。现阶段有 4 中平台规范。这点是根 OCI Image 规范不太一样的地方。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;linux：&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/runtime.md"&gt;runtime.md&lt;/a&gt;，&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/config.md"&gt;config.md&lt;/a&gt;，&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md"&gt;config-linux.md&lt;/a&gt; 和 &lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/runtime-linux.md"&gt;runtime-linux.md&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;solaris：&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/runtime.md"&gt;runtime.md&lt;/a&gt;，&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/config.md"&gt;config.md&lt;/a&gt; 和 &lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/config-solaris.md"&gt;config-solaris.md&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;windows：&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/runtime.md"&gt;runtime.md&lt;/a&gt;，&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/config.md"&gt;config.md&lt;/a&gt; 和 &lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/config-windows.md"&gt;config-windows.md&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;vm：&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/runtime.md"&gt;runtime.md&lt;/a&gt;，&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/config.md"&gt;config.md&lt;/a&gt; 和 &lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/config-vm.md"&gt;config-vm.md&lt;/a&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;由于我们日常使用 linux，所以下面就只研究 linux 平台的 OCI Runtime 规范&lt;/p&gt;
&lt;p&gt;runtime 规范有如下几个，所有人必须遵守该规范来使用 runtime ：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/bundle.md"&gt;Filesystem Bundle&lt;/a&gt; # 文件系统捆绑。bundle 是以某种方式组织的一组文件，包含了容器所需要的所有信息，有了这个 bundle 后，符合 runtime 标准的程序(e.g.runc)就可以根据 bundle 启动容器了(哪怕没有 docker，也可以启动一个容器)。&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/runtime.md"&gt;Runtime and Lifecycle&lt;/a&gt; # 使用一个 runtime 创建的容器实体必须能够对同一容器使用本规范中定义的操作。
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/runtime-linux.md"&gt;Linux-specific Runtime and Lifecycle&lt;/a&gt; # 这是关于 linux 平台的 Runtime 与 Lifecycle&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/config.md"&gt;Configuration&lt;/a&gt; # Configuration 包含对容器执行标准操作(比如 create、start、stop 等)所必须的元数据。这包括要运行的过程、要注入的环境变量、要使用的沙盒功能等等。不同平台(linux、window 等)，有不同的规范。
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md"&gt;Linux-specific configuration&lt;/a&gt; # 这是关于 linux 平台的 Configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id="filesystem-bundle"&gt;Filesystem Bundle&lt;a class="td-heading-self-link" href="#filesystem-bundle" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;官方详解：&lt;a href="https://github.com/opencontainers/runtime-spec/blob/master/bundle.md"&gt;https://github.com/opencontainers/runtime-spec/blob/master/bundle.md&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>