3.9 KiB
3.9 KiB
本文作者:丁辉
Ubuntu网络源安装Containerd
Ubuntu部署Containerd配置Apt源
我部署 containerd 的时候遇到了各个版本 apt 源无法下载的问题,所以本次记录 Ubuntu 源配置步骤
安装必须源
apt -y install apt-transport-https ca-certificates curl software-properties-common
Ubuntu 22.04(现代添加推荐方法)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Ubuntu 21.10(传统添加方法)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu impish stable"
Ubuntu 21.04(传统添加方法)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu hirsute stable"
Ubuntu 20.10 (传统添加方法)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu groovy stable"
Ubuntu 20.04(传统添加方法)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
Ubuntu 19.10 (传统添加方法)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu eoan stable"
Ubuntu 19.04(传统添加方法)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu disco stable"
Ubuntu 18.10(传统添加方法)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu cosmic test"
Ubuntu 18.04(传统添加方法)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
Ubuntu 17.10(传统添加方法)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable"
Ubuntu 16.04(传统添加方法)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
开始安装
-
更新包索引
apt update -
安装 Containerd
apt install containerd.io -y -
配置 Containerd
mkdir -p /etc/containerd使用默认配置文件
containerd config default | tee /etc/containerd/config.toml -
修改驱动和镜像地址
vi /etc/containerd/config.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' -
启动
systemctl enable containerd systemctl start containerd systemctl status containerd -
验证
ctr info