3

In Docker, we can configure persistent storage via volumes. In Docker cli, we use "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.

It looks like the containerd cli (ctr) doesn't have an equivalent item. They do have content:

$ 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

There is also snapshot:

$ 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

Which is the equivalent? And how should I be interpreting the results from ctr cli outputs?

mmking
  • 1,564
  • 4
  • 26
  • 36

1 Answers1

2

From: https://containerd.io/scope/

containerd is designed to be embedded into a larger system, hence it only includes a barebone CLI (ctr) specifically for development and debugging purpose, with no mandate to be human-friendly, and no guarantee of interface stability over time.

Have a look at runc: https://danishpraka.sh/2020/07/24/introduction-to-runc.html

runtime-spec

Specifying configuration options such as volume mounts, memory limits or uid:gid mapping while running a container with docker is as simple as specifying command line options to the docker command. While using runc, these configurations are passed to runc as a file. This configuration file, the runtime-spec, is a configuration standard put in place by the Open Container Initiative (OCI) to specify options for a container and is used by runc[2]. In simpler words, the runtime-spec is a JSON file named config.json consisting of configurations pertaining to a specific container.

J. Scott Elblein
  • 4,013
  • 15
  • 58
  • 94
  • A bit of a different question: "docker volume" generates storage via a folder on the host file system. I'm assuming that your response basically means containerd has no equivalent functionality (i.e., runc will allow you to mount an existing folder but won't create an empty folder for you). – mmking Dec 15 '20 at 01:34
  • In that case though, would you happen to know what "ctr content" and "ctr snapshot" are supposed to be? – mmking Dec 15 '20 at 01:39
  • @mmking Sorry, I'm not real familiar with containerd and runc; I usually use the regular docker commands + portainer to manage my containers. My impression is that they are just a subset of operations, similar to how Busybox is for Linux tools. – J. Scott Elblein Dec 17 '20 at 00:40