此脚本是Linux一键部署ShowDoc接口文档自动化脚本,有需要朋友可以参考,脚本内容如下:
环境准备:
操作系统:CentOS Linux release 7.8.2003文章源自小柒网-https://www.yangxingzhen.cn/7612.html
软件版本:
Docker:docker-ce-19.03.12文章源自小柒网-https://www.yangxingzhen.cn/7612.html
[root@localhost ~]# vim install_showdoc.sh文章源自小柒网-https://www.yangxingzhen.cn/7612.html
- #!/bin/bash
- #Date:2020-8-21 10:26:28
- #Author Blog:
- # https://www.yangxingzhen.cn
- # https://www.i7ti.cn
- #Author WeChat:
- # 微信公众号:小柒博客
- #Author mirrors site:
- # https://mirrors.yangxingzhen.com
- #About the Author
- # BY:YangXingZhen
- # Mail:xingzhen.yang@yangxingzhen.com
- # QQ:675583110
- #Auto Install Docker-ce And ShowDoc
- IPADDR=$(hostname -I |awk '{print $1}')
- # 安装Docker-ce
- rpm -qa |grep "docker-ce" >/dev/null 2>&1
- if [ $? -ne 0 ];then
- #curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
- yum -y install yum-utils device-mapper-persistent-data lvm2 >/dev/null
- yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- yum -y install docker-ce-19.03.12 docker-ce-cli-19.03.12 containerd.io >/dev/null
- fi
- # 配置镜像加速器
- mkdir -p /etc/docker
- cat >/etc/docker/daemon.json <<EOF
- {
- "registry-mirrors": [
- "https://hub-mirror.c.163.com",
- "https://reg-mirror.qiniu.com",
- "https://registry.docker-cn.com",
- "https://lhbk6z9b.mirror.aliyuncs.com"
- ]
- }
- EOF
- # 开启TCP管理端口
- sed -i 's#/usr/bin/dockerd#& -H tcp://0.0.0.0:2375#' /usr/lib/systemd/system/docker.service
- # 启动Docker
- systemctl daemon-reload
- systemctl enable docker
- systemctl start docker
- # 安装ShowDoc
- # 拉取ShowDoc镜像(原版官方镜像安装命令)
- #docker pull star7th/showdoc
- # 拉取ShowDoc镜像(基于国内阿里云镜像,安装后记得执行docker tag命令以进行重命名)
- docker pull registry.cn-shenzhen.aliyuncs.com/star7th/showdoc
- docker tag registry.cn-shenzhen.aliyuncs.com/star7th/showdoc:latest star7th/showdoc:latest
- # 创建持久化数据目录
- mkdir -p /data/showdoc/html
- # 启动ShowDoc
- docker run -d --user=root --privileged=true -p 80:80 --name showdoc -v /data/showdoc/html:/var/www/html star7th/showdoc
- User="showdoc"
- Passwd="123456"
- echo -e "\033[32mShowDoc访问地址:http://${IPADDR}\n用户名:${User}\n密码:${Passwd}\033[0m"
脚本执行方式:文章源自小柒网-https://www.yangxingzhen.cn/7612.html
[root@localhost ~]# sh install_showdoc.sh文章源自小柒网-https://www.yangxingzhen.cn/7612.html
脚本执行过程截图如下文章源自小柒网-https://www.yangxingzhen.cn/7612.html
文章源自小柒网-https://www.yangxingzhen.cn/7612.html
文章源自小柒网-https://www.yangxingzhen.cn/7612.html
文章源自小柒网-https://www.yangxingzhen.cn/7612.html
文章源自小柒网-https://www.yangxingzhen.cn/7612.html
若文章图片、下载链接等信息出错,请在评论区留言反馈,博主将第一时间更新!如本文“对您有用”,欢迎随意打赏,谢谢!
继续阅读
Wechat
微信扫一扫,加我!

我的微信
微信号已复制
微信公众号
微信扫一扫,关注我!

我的公众号
公众号已复制
评论