[containerd] 全局参数——root & state参数的含义

containerd的全局选项中,root参数用于指定元数据如镜像和运行时数据的存储位置,默认为/var/lib/containerd,而state参数则指定了containerd监听的socket文件位置,默认为/run/containerd。这两个参数对于理解和配置containerd容器运行时至关重要。
摘要由CSDN通过智能技术生成

  执行,containerd help,你会发现,containerdglobol options中有两个参数,一个为root,一个为state。这两个参数乍一看上去搞得很懵逼,着实有点不理解到底是用来配置什么的。

root@containerd:/run/containerd# containerd help
NAME:
   containerd -
                    __        _                     __
  _________  ____  / /_____ _(_)___  ___  _________/ /
 / ___/ __ \/ __ \/ __/ __ `/ / __ \/ _ \/ ___/ __  /
/ /__/ /_/ / / / / /_/ /_/ / / / / /  __/ /  / /_/ /
\___/\____/_/ /_/\__/\__,_/_/_/ /_/\___/_/   \__,_/

high performance container runtime


USAGE:
   containerd [global options] command [command options] [arguments...]

VERSION:
   v1.7.2

DESCRIPTION:

containerd is a high performance container runtime whose daemon can be started
by using this command. If none of the *config*, *publish*, *oci-hook*, or *help* commands
are specified, the default action of the **containerd** command is to start the
containerd daemon in the foreground.


A default configuration is used if no TOML configuration is specified or located
at the default file location. The *containerd config* command can be used to
generate the default configuration for containerd. The output of that command
can be used and modified as necessary as a custom configuration.

COMMANDS:
   config    Information on the containerd config
   publish   Binary to publish events to containerd
   oci-hook  Provides a base for OCI runtime hooks to allow arguments to be injected.
   help, h   Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --config value, -c value     Path to the configuration file (default: "/etc/containerd/config.toml")
   --log-level value, -l value  Set the logging level [trace, debug, info, warn, error, fatal, panic]
   --address value, -a value    Address for containerd's GRPC server
   --root value                 containerd root directory
   --state value                containerd state directory
   --help, -h                   show help
   --version, -v                print the version
root@containerd:/run/containerd#

  通过debug containerd源码,我发现root默认值为/var/lib/containerd;而state默认值为/run/containerd。看到这里你是不是一下就明白这两个参数的作用了?实际上root参数是为cotnainerd指定元数据的存放位置,譬如镜像,运行时的一些数据。state参数则是为了指定containerd监听的socket文件的位置。

root@containerd:/run/containerd# tree -L 3 /var/lib/containerd/
/var/lib/containerd/
├── io.containerd.content.v1.content
│   ├── blobs
│   │   └── sha256
│   └── ingest
├── io.containerd.metadata.v1.bolt
│   └── meta.db
├── io.containerd.runtime.v1.linux
├── io.containerd.runtime.v2.task
├── io.containerd.snapshotter.v1.btrfs
├── io.containerd.snapshotter.v1.native
│   └── snapshots
├── io.containerd.snapshotter.v1.overlayfs
│   ├── metadata.db
│   └── snapshots
│       ├── 48
│       ├── 61
│       ├── 62
│       ├── 63
│       ├── 64
│       ├── 65
│       ├── 66
│       ├── 67
│       ├── 68
│       ├── 69
│       ├── 70
│       ├── 71
│       ├── 72
│       └── 75
└── tmpmounts

27 directories, 2 files
root@containerd:/run/containerd#
root@containerd:/run/containerd#
root@containerd:/run/containerd# tree -L 3 /run/containerd/
/run/containerd/
├── containerd.sock.ttrpc
├── io.containerd.runtime.v1.linux
└── io.containerd.runtime.v2.task

2 directories, 1 file
root@containerd:/run/containerd#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值