#!/usr/bin/bash set -e unset c color(){ declare -A c=([Error]=31 [Success]=32 [Warning]=33 [Info]=34) #echo -e "\033[${c[$1]}m[`date +%T`]($1) $2\033[0m" printf "\033[${c[$1]}m%-10s%-10s %-30s\033[0m\n" "[`date +%T`]" "($1)" "$2" sleep 0.5 } install(){ color Info "开始安装docker服务" yum install -y yum-utils device-mapper-persistent-data lvm2 git && \ yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo && \ yum install -y docker-ce mkdir -p /etc/docker color Success "安装完成" color Info "开始配置镜像加速器" tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://pilvpemn.mirror.aliyuncs.com"] } EOF cat >> /etc/sysctl.conf <