安装 cri-dockerd
#1.切换镜像源
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#2.设置国内镜像并重启 daemon
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"exec-opts": ["native.cgroupdriver=systemd"],
"registry-mirrors": ["https://j16wttpi.mirror.aliyuncs.com"]
}
EOF
#3.进行安装命令,并设置docker自动重启
yum install -y docker-ce
systemctl start docker
systemctl enable docker
#4.查看并验证
docker info
git拉取方式
#1.安装git并拉取cri-dockerd
yum install -y git
git clone https://github.com/Mirantis/cri-dockerd.git
#2.安装go
wget https://storage.googleapis.com/golang/getgo/installer_linux
chmod +x ./installer_linux
./installer_linux
source ~/.bash_profile
go version
#3.安装cri-dockerd
cd cri-dockerd
mkdir bin
go build -o bin/cri-dockerd
mkdir -p /usr/local/bin
install -o root -g root -m 0755 bin/cri-dockerd /usr/local/bin/cri-dockerd
cp -a packaging/systemd/* /etc/systemd/system
sed -i -e 's,/usr/bin/cri-dockerd,/usr/local/bin/cri-dockerd,' /etc/systemd/system/cri-docker.service
systemctl daemon-reload
systemctl enable cri-docker.service
systemctl enable --now cri-docker.socket
go的安装方式
#1.解压go的安装包至/usr/local目录下
tar -C /usr/local/ -zxf go1.20.2.linux-amd64.tar.gz
#2.配置环境变量并验证
vim /etc/profile
#go
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
source /etc/profile
go version
git拉取不下来
#1.手动在githud上下载对应的
cri-dockerd-master.zip
#2.解压cri-dockerd-master.zip
unzip cri-dockerd-master.zip
#3.重命名cri-dockerd-master
mv cri-dockerd-master cri-dockerd
#4.安装cri-docker
cd cri-dockerd
mkdir bin
go build -o bin/cri-dockerd
mkdir -p /usr/local/bin
install -o root -g root -m 0755 bin/cri-dockerd /usr/local/bin/cri-dockerd
cp -a packaging/systemd/* /etc/systemd/system
sed -i -e 's,/usr/bin/cri-dockerd,/usr/local/bin/cri-dockerd,' /etc/systemd/system/cri-docker.service
systemctl daemon-reload
systemctl enable cri-docker.service
systemctl enable --now cri-docker.socket