From c9bdc8cd14a016e630fafd5a83a0cab54b1e0270 Mon Sep 17 00:00:00 2001 From: tan <447542994@qq.com> Date: Tue, 15 Jan 2019 16:36:58 +0800 Subject: [PATCH] add docker install script --- docker_install_centos.sh | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 docker_install_centos.sh diff --git a/docker_install_centos.sh b/docker_install_centos.sh new file mode 100755 index 0000000..c43814e --- /dev/null +++ b/docker_install_centos.sh @@ -0,0 +1,45 @@ +#!/bin/bash +#author: MonsterTan +#date: 2019-01-15 +#this is a script that can install automatically docker software by centos7 + + + +function checkSudo (){ + if [ $UID -ne 0 ];then + echo -e 'it must be root!' + exit 1 + fi +} + +checkSudo + +## something required system utils +yum install -y yum-utils device-mapper-persistent-data lvm2 + + +## add repo source info +sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo + + +sudo yum mackecache fast +sudo yum -y install docker-ce +sudo systemctl start docker + + +str=successed! +if [ $? -eq 0 ];then + echo -e "\033[32msuccessed!\033[0m" +else + echo -e "\033[31msomething wrong, please check!\033[0m" +fi + +echo -e "\033[31mstart to install docker-compose\033[0m" + +result=`ls /usr/bin/ | grep ^pip$` +if [ ${#result} -eq 0 ];then + echo -e "\033[31mpip must be necessary, it should be installed firstly\033[0m" +fi + +sudo pip install docker-compose +