linux-tutorial/codes/linux/soft/docker-install.sh

49 lines
1.3 KiB
Bash
Raw Normal View History

2019-07-11 16:52:03 +08:00
#!/usr/bin/env bash
###################################################################################
# 控制台颜色
BLACK="\033[1;30m"
RED="\033[1;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
BLUE="\033[1;34m"
PURPLE="\033[1;35m"
CYAN="\033[1;36m"
RESET="$(tput sgr0)"
###################################################################################
printf "${BLUE}"
cat << EOF
###################################################################################
2019-07-29 10:46:59 +08:00
# 安装 Docker 脚本
2019-07-11 16:52:03 +08:00
# 适用于所有 linux 发行版本。
# @author: Zhang Peng
###################################################################################
EOF
printf "${RESET}"
2019-07-29 10:46:59 +08:00
printf "${GREEN}>>>>>>>> install docker begin.${RESET}\n"
# uninstall old version docker
2019-10-10 08:56:31 +08:00
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
2019-07-29 10:46:59 +08:00
# install required libs
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# add docker yum repo
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum makecache fast
# install docker
sudo yum -y install docker-ce
sudo systemctl start docker
docker version
printf "${GREEN}<<<<<<<< install docker end.${RESET}\n"