2

在 Docker 中,我们可以通过卷配置持久存储。在 Docker cli 中,我们使用“docker volume”:

$ docker volume --help

Usage:  docker volume COMMAND

Manage volumes

Commands:
  create      Create a volume
  inspect     Display detailed information on one or more volumes
  ls          List volumes
  prune       Remove all unused local volumes
  rm          Remove one or more volumes

Run 'docker volume COMMAND --help' for more information on a command.

看起来 containerd cli (ctr) 没有等效项。他们确实有内容:

$ ctr content --help
NAME:
   ctr content - manage content

USAGE:
   ctr content command [command options] [arguments...]

COMMANDS:
   active                   display active transfers
   delete, del, remove, rm  permanently delete one or more blobs
   edit                     edit a blob and return a new digest
   fetch                    fetch all content for an image into containerd
   fetch-object             retrieve objects from a remote
   get                      get the data for an object
   ingest                   accept content into the store
   list, ls                 list all blobs in the store
   push-object              push an object to a remote
   label                    add labels to content

OPTIONS:
   --help, -h  show help

还有截图:

$ ctr snapshot --help
NAME:
   ctr snapshots - manage snapshots

USAGE:
   ctr snapshots command [command options] [arguments...]

COMMANDS:
   commit            commit an active snapshot into the provided name
   diff              get the diff of two snapshots. the default second snapshot is the first snapshot's parent.
   info              get info about a snapshot
   list, ls          list snapshots
   mounts, m, mount  mount gets mount commands for the snapshots
   prepare           prepare a snapshot from a committed snapshot
   remove, rm        remove snapshots
   label             add labels to content
   tree              display tree view of snapshot branches
   unpack            unpack applies layers from a manifest to a snapshot
   usage             usage snapshots
   view              create a read-only snapshot from a committed snapshot

OPTIONS:
   --snapshotter value  snapshotter name. Empty value stands for the default value. [$CONTAINERD_SNAPSHOTTER]
   --help, -h           show help

哪个是等价的?我应该如何解释 ctr cli 输出的结果?

4

1 回答 1

2

来自:https ://containerd.io/scope/

containerd 被设计为嵌入到更大的系统中,因此它只包含一个专门用于开发和调试目的的准系统 CLI (ctr),没有要求人性化,也不能保证界面随时间的稳定性。

看看runchttps ://danishpraka.sh/2020/07/24/introduction-to-runc.html

运行时规范

在使用 docker 运行容器时指定配置选项(例如卷挂载、内存限制或 uid:gid 映射)就像为 docker 命令指定命令行选项一样简单。在使用 runc 时,这些配置将作为文件传递给 runc。此配置文件,即运行时规范,是由开放容器倡议 (OCI) 制定的配置标准,用于指定容器的选项,并由 runc[2] 使用。简单来说,runtime-spec 是一个名为 config.json 的 JSON 文件,由与特定容器相关的配置组成。

于 2020-12-15T00:49:45.500 回答