1 Star 0 Fork 0

活着VIVA/CentOS Init

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Init2.sh 1.99 KB
一键复制 编辑 原始数据 按行查看 历史
活着VIVA 提交于 2021-11-29 18:41 +08:00 . add Init2.sh.
#!/bin/bash
echo "Begin"
#创建网络
docker -v
if [[ `docker network ls | grep "jy_net"` == "" ]]; then
echo "step: creat network jy_net"
docker network create --driver bridge --subnet 172.200.0.0/16 --gateway 172.200.0.1 jy_net
fi
########
#portainer
pname="myPortainer" #容器名
docker inspect $pname -f '{{.Name}}' > /dev/null
if [ $? -ne 0 ] ;then
portainerdir="/home/portainer"
if [ ! -d $portainerdir ];then
echo "step: creat chinese portainer dir"
mkdir $portainerdir
fi
if [[ `command -v 7za` == "" ]];then
echo "step: pre chinese file"
yum install -y epel-release
yum install -y p7zip
#下载汉化包
if [ ! -d $portainerdir/public ]; then
echo "step: download chinese file"
wget -N -P $portainerdir https://gitee.com/yifff/cent-os-init/attach_files/887602/download/public.7z
if [ $? -ne 0 ]; then
echo "wget public fail exit"
exit 8
fi
echo "step: 7z chinese file"
7za x $portainerdir/public.7z -r -o$portainerdir/
fi
fi
#创建虚拟盘
if [[ `docker volume ls | grep "portainer_data"` == "" ]]; then
echo "step: creat docker volume portainer_data"
docker volume create portainer_data
fi
#下载指定版本
if [[ `docker images | grep "portainer/portainer"` == "" ]]; then
echo "step: docker pull image portainer"
docker pull portainer/portainer:linux-amd64-1.20.2
fi
echo "step: run docker image portainer"
docker run --name $pname -d --restart=always -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data -v /home/portainer/public:/public portainer/portainer:linux-amd64-1.20.2
fi
######
#dockercompose
bindir="/usr/local/bin"
if [[ `command -v docker-compose` == "" ]];then
echo "setp: download docker-compose"
wget -N -O $bindir/docker-compose https://gitee.com/yifff/cent-os-init/attach_files/895370/download/docker-compose-linux-x86_64
chmod +x $bindir/docker-compose
fi
echo "end "
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yifff/cent-os-init.git
git@gitee.com:yifff/cent-os-init.git
yifff
cent-os-init
CentOS Init
master

搜索帮助