COLOR="echo -e \\033[1;31m"END="\033[m"DOCKER_VERSION="5:19.03.5~3-0~ubuntu-bionic"install_docker(){${COLOR}"开始安装 Docker....."${END}sleep 1 apt update apt -y install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"apt update${COLOR}"Docker有以下版本:"${END}sleep 2 apt-cache madison docker-ce${COLOR}"5秒后即将安装: docker-"${DOCKER_VERSION}" 版本....."${END}${COLOR}"如果想安装其它Docker版本,请按ctrl+c键退出,修改版本再执行"${END}sleep 5 apt -y install docker-ce=${DOCKER_VERSION} docker-ce-cli=${DOCKER_VERSION}mkdir -p /etc/docker tee /etc/docker/daemon.json <<-'EOF'{ "registry-mirrors": ["https://si7y70hh.mirror.aliyuncs.com"] } EOF systemctl daemon-reload systemctl restart docker docker version && ${COLOR}"Docker 安装完成"${END} || ${COLOR}"Docker 安装失败"${END}}install_docker_compose(){${COLOR}"开始安装 Docker compose....."${END}sleep 1 curl -L https://github.com/docker/compose/releases/download/1.25.3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose docker-compose --version && ${COLOR}"Docker Compose 安装完成"${END} || ${COLOR}"Docker compose 安装失败"${END}} dpkg -s docker-ce &> /dev/null && ${COLOR}"Docker已安装"${END} || install_docker docker-compose --version &> /dev/null && ${COLOR}"Docker Compose已安装"${END} || install_docker_compose