Files
one-click-shell/docker-ce/docker-ce-yum-install.sh

50 lines
1.6 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 卸载旧版本
# yum remove docker \
# docker-client \
# docker-client-latest \
# docker-common \
# docker-latest \
# docker-latest-logrotate \
# docker-logrotate \
# docker-engine
# 安装所需软件包
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
# 设置存储库
# 阿里云 http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 安装最新版的 docker-ce
yum -y install docker-ce docker-ce-cli containerd.io
# 配置阿里云 docker 镜像加速器
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://ki523tnj.mirror.aliyuncs.com"]
}
EOF
# 重新加载配置、重启 docker
systemctl daemon-reload
systemctl restart docker
# 安装 docker-compose
# 下载 docker-compose由于下载速度过慢提前已经下载完成
# wget https://github.com/docker/compose/releases/download/v2.11.1/docker-compose-linux-x86_64
# https://git.stewednoodles.com/jiulinxiri/one-click-shell/raw/branch/master/docker-ce/docker-ce-yum-install.sh
wget https://git.stewednoodles.com/jiulinxiri/one-click-shell/raw/branch/master/docker-ce/docker-compose-linux-x86_64
mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
# 赋予可执行权限
chmod +x /usr/local/bin/docker-compose
echo "===================================================="
docker -v
docker-compose --version
echo "===================================================="