zoukankan      html  css  js  c++  java
  • docker容器部署gitlab

    #!/bin/bash
    
    serverName="gitlab"
    imageName="gitlab/gitlab-ce:latest"
    #imageName="gitlab/gitlab-ee:latest"
    
    function runServer(){
        docker run --detach 
            -p 9443:443 
            -p 9080:80 
            -p 10022:22 
            --name ${serverName} 
            -/gitlab-data/etc:/etc/gitlab 
            -/gitlab-data/log:/var/log/gitlab 
            -/gitlab-data/data:/var/opt/gitlab 
            -v /etc/localtime:/etc/localtime 
            --restart=unless-stopped 
            ${imageName}
    }
    
    runningCount=`docker ps -f status=running -f status=restarting | grep -w ${serverName} |wc -l`;
    if [[ ${runningCount} > 0 ]];then
        echo "docker restart 重启项目:${serverName}"
        docker restart ${serverName}
        exit 0
    fi
    
    serverCount=`docker ps -f status=exited -f status=created | grep -w ${serverName} |wc -l`;
    # 判断是否已经启动过,且端口为默认端口
    if [[ ${serverCount} > 0 ]];then
        if [[ ${serverCount} > 1 ]]; then
            echo "Error : 查找到多个 ${serverName} 容器,请手动启动"
            exit 1
        else
            echo "docker start 启动项目:${serverName}"
            docker start ${serverName}
        fi
    else
        name=${imageName%%:*}
        tag=${imageName##*:}
        # 判断是否有该镜像
        imageCount=`docker images | grep -w ${name} | wc -l`;
    
        if [[ ${imageCount} > 0 ]];then
            echo "docker run 第一次启动项目: ${imageName}"
            runServer
        else
            echo "Error : 还没有该镜像"
            exit 1
        fi
    fi
    
    
    
    有趣的事,有趣的人,有趣的灵魂!
  • 相关阅读:
    html5css练习 旋转
    html5 css练习 画廊 元素旋转
    html5 渐变按钮练习
    html5 旋转导航练习
    html5 javascript 表单练习案例
    html5 p1练习1,移动页面,标准标签布局
    pyqt5desinger的安装即配置
    python 文件操作
    openGL 大作业之n星变换
    openGL 蓝天白云
  • 原文地址:https://www.cnblogs.com/alusss/p/12722016.html
Copyright © 2011-2022 走看看