#!/bin/bash
. /etc/profile
DRIVER="overlay2"
# 需要 514/957 内核
kv=$(uname -r | grep -Po '(?<=3.10.0-)\d+')
if [[ -n "$kv" ]]; then
if [[ $kv -lt 514 ]]; then
uname -a
echo -e "docker 1.13 以上版本至少需要 3.10.0-514 内核"
yum list kernel --showdup
echo -e "请从上面的列表选择,手动执行 yum install kernel-3.10.0-xxx.... glibc systemd dbus polkit 后重启"
fi
fi
# 卸载老docker
yum install -y psmisc
killall -9 dockerd docker-containerd /usr/bin/dockerd
yum remove -y docker docker-common docker-selinux docker-engine docker-ce docker-ce-cli containerd.io
rm -rf /etc/docker /etc/containerd /etc/sysconfig/docker* /etc/systemd/system/multi-user.target.wants/docker.service /usr/lib/systemd/system/docker.service /bin/dockerd /bin/docker /usr/bin/dockerd /usr/bin/docker /usr/lib/systemd/system/docker.service.d /etc/systemd/system/docker.service.d /etc/systemd/system/docker.service
# 安装docker-18.09
yum install docker-ce -y
mkdir -p /etc/docker /etc/containerd
cat >/etc/containerd/config.toml <<EOF
disabled_plugins = ["cri"]
root = "/data0/docker-18.09.0-fs/containerd"
#root = "/var/lib/containerd"
#state = "/run/containerd"
#subreaper = true
#oom_score = 0
#[grpc]
# address = "/run/containerd/containerd.sock"
# uid = 0
# gid = 0
#[debug]
# address = "/run/containerd/debug.sock"
# uid = 0
# gid = 0
# level = "info"
EOF
# 重启
systemctl daemon-reload
systemctl restart docker
systemctl enable docker
强制卸载docker脚本
最新推荐文章于 2024-08-12 20:56:07 发布