docker-install.sh 839 B

123456789101112131415161718
  1. #!/bin/bash
  2. # shellcheck disable=SC2046
  3. BASE_PATH=$(cd `dirname $0`;pwd)
  4. echo "当前系统版本:";sudo cat /etc/redhat-release;
  5. echo -e "\033[46;37;5m -------------- 开始安装docker所需环境 -------------- \033[0m";
  6. # 安装docker环境
  7. echo " ------------ 开始安装docker服务 ------------ ";
  8. yum update -y;
  9. yum install -y yum-utils device-mapper-persistent-data lvm2;
  10. yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo;
  11. yum install -y docker-ce;
  12. systemctl start docker;
  13. systemctl enable docker;
  14. docker version;
  15. sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;
  16. sudo chmod +x /usr/local/bin/docker-compose;
  17. docker-compose version;
  18. echo " ------------ docker服务安装完毕 ------------ ";