update docker

This commit is contained in:
qiaofeng1227 2023-05-29 17:45:30 +08:00
parent cd7c207943
commit d7d9a0c205

View file

@ -145,46 +145,10 @@ UpdateDocker(){
echo "Parpare to update Docker to latest ..."
if [ "$os_type" == 'CentOS' ];then
curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
fi
if [ "$os_type" == 'Ubuntu' ] || [ "$os_type" == 'Debian' ] ;then
apt-get update
while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
echo "Waiting for other software managers to finish..."
sleep 5
done
curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh
sleep 30
fi
if [ "$os_type" == 'OracleLinux' ] ;then
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
fi
if [ "$os_type" == 'Fedora' ] ;then
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/fedora/docker-ce.repo
sudo yum install device-mapper-persistent-data lvm2 docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-scan-plugin docker-ce-rootless-extras -y
fi
if [ "$os_type" == 'Redhat' ] ;then
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine podman runc -y 1>/dev/null 2>&1
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
fi
if [ "$os_type" == 'CentOS Stream' ] ;then
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine podman runc -y 1>/dev/null 2>&1
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
fi
sudo systemctl start docker
sudo systemctl enable docker
if ! docker network inspect websoft9 > /dev/null 2>&1; then
sudo docker network create websoft9
if command -v apt > /dev/null;then
sudo apt -y install --only-upgrade docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
elif command -v yum > /dev/null;then
sudo yum update -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
fi
}