68 lines
1.4 KiB
Markdown
68 lines
1.4 KiB
Markdown
> 本文作者:丁辉
|
|
|
|
# Centos网络源安装Containerd
|
|
|
|
1. 设置存储库
|
|
|
|
[阿里源配置文件](https://developer.aliyun.com/mirror/docker-ce?spm=a2c6h.13651102.0.0.4eac1b11shXBpr)
|
|
|
|
```bash
|
|
yum install -y yum-utils
|
|
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
|
|
```
|
|
|
|
> 国内
|
|
>
|
|
> ```bash
|
|
> yum install -y yum-utils
|
|
> yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
|
|
> ```
|
|
|
|
2. 安装
|
|
|
|
```bash
|
|
yum install -y containerd.io
|
|
```
|
|
|
|
3. 备份配置文件并使用默认配置文件
|
|
|
|
```bash
|
|
mv /etc/containerd/config.toml /etc/containerd/config.toml.bak
|
|
containerd config default > /etc/containerd/config.toml
|
|
```
|
|
|
|
4. 修改驱动和镜像地址
|
|
|
|
```bash
|
|
vi /etc/containerd/config.toml
|
|
```
|
|
|
|
内容如下(已更新为最新版配置方法,旧版层级不同)
|
|
|
|
```toml
|
|
[plugins]
|
|
...
|
|
[plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.runc.options]
|
|
SystemdCgroup = true # 修改这里用于配置容器运行时使用 systemd 作为 cgroup 驱动 的关键设置
|
|
|
|
[plugins.'io.containerd.cri.v1.images'.pinned_images]
|
|
sandbox = 'registry.aliyuncs.com/google_containers/pause:3.10.1'
|
|
```
|
|
|
|
5. 启动
|
|
|
|
```bash
|
|
systemctl enable containerd
|
|
systemctl start containerd
|
|
systemctl status containerd
|
|
```
|
|
|
|
6. 验证
|
|
|
|
```bash
|
|
ctr info
|
|
```
|
|
|
|
|
|
|