1 Star 0 Fork 52

紫枫信息.co/UnifiedDeploymentPlatform

forked from java110/HCDoc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
docker.sh 2.14 KB
一键复制 编辑 原始数据 按行查看 历史
leojava 提交于 2020-03-16 08:32 . 修改了需要安装的依赖
#!/bin/bash
# +-------------------------------------------------------------------
# | HC-docker一键安装程序
# | Author: 王天良([email protected])
# +--------------------------------------------------------------------
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
install_tmp='/tmp/install.pl'
sys_path="/hcdemo"
Install_Docker_ce()
{
#install docker-ce
#pip install pytz
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine -y
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce
#systemctl or service
if [ -f /usr/bin/systemctl ];then
systemctl stop [email protected]
systemctl mask [email protected]
systemctl enable docker
systemctl start docker
else
chkconfig --add docker
chkconfig --level 2345 docker on
service docker start
fi
}
Install_docker()
{
mkdir -p /$sys_path/server/docker
systemctl start docker
is_start=$(systemctl status docker|grep "active (running)")
if [ "$is_start" == "" ];then
rm -f /var/lib/docker
if [ -f "/usr/bin/apt-get" ];then
Install_Ubuntu_ce
elif [ -f "/usr/bin/yum" ];then
Install_Docker_ce
fi
fi
echo '安装完成' > $install_tmp
}
Uninstall_docker()
{
rm -rf /$sys_path/server/docker
# rm -rf /usr/bin/docker
if [ -f "/usr/bin/apt-get" ];then
systemctl stop docker
#pip uninstall docker -y
yum -y remove docker docker-common docker-selinux docker-engine
elif [ -f "/usr/bin/yum" ];then
if [ -f /usr/bin/systemctl ];then
systemctl disable docker
systemctl stop docker
else
service docker stop
chkconfig --level 2345 docker off
chkconfig --del docker
fi
#pip uninstall docker -y
yum -y remove docker docker-common docker-selinux docker-engine
fi
}
action=$1
if [ "${1}" == 'install' ];then
Install_docker
elif [ "${1}" == 'update' ];then
Install_docker
elif [ "${1}" == 'uninstall' ];then
Uninstall_docker
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/fulusco/UnifiedDeploymentPlatform.git
[email protected]:fulusco/UnifiedDeploymentPlatform.git
fulusco
UnifiedDeploymentPlatform
UnifiedDeploymentPlatform
master

搜索帮助