zoukankan      html  css  js  c++  java
  • docker容器升级脚本

    #!/bin/bash
    # Let's finish it like a flash
    # usage:sh -x update_cms_backend.sh -v 2018050401
    
    ARGS=`getopt -o v:"$@"`
    echo $#
    if [ $# != 2 ];then
            echo "Need new version"
            exit
    fi
    
    case "$1" in
            -v)
                    echo "new version: ". $2
                    SERVICE_VERSION=$2
                    ;;
    esac
    
    REGISTRY_URL="172.16.161.215:5000/cloud_portal/portal"
    
    SSO_HOST='172.16.160.106'
    SSO_PORT="8010"
    MYSQL_HOST="172.16.160.106"
    MYSQL_PORT="3306"
    MYSQL_DB="portal_db"
    MYSQL_PASSWORD='123456!'
    K8S_URL="http://172.16.160.245:8090"
    REDIS_HOST="172.16.160.106"
    
    # GET the container id for stop and delete
    CONTAINER_ID=`docker ps -a | grep 8080 | cut -d " " -f 1`
    docker stop ${CONTAINER_ID}
    sleep 2
    docker rm ${CONTAINER_ID}
    sleep 2
    
    docker run -itd --name cms -p 8080:8080 --restart=always -v /home/portal/upload:/home/portal/upload -e SSO_HOST=${SSO_HOST} -e SSO_PORT=${SSO_PORT} -e MYSQL_HOST=${MYSQL_HOST} -e MYSQL_PORT=${MYSQL_PORT} -e MYSQL_DB=${MYSQL_DB} -e MYSQL_PASSWORD=${MYSQL_PASSWORD} -e K8S_URL=${K8S_URL} -e REDIS_HOST=${REDIS_HOST} ${REGISTRY_URL}:${SERVICE_VERSION}
    
    #docker run -itd  --rm --name cms  -p 8080:8080 -e SSO_HOST='172.16.160.106' -e SSO_PORT="8010" -e MYSQL_HOST="172.16.160.106" -e MYSQL_PORT="3306" -e MYSQL_DB="portal_db" -e MYSQL_PASSWORD='123456!' -e K8S_URL="http://172.16.160.245:8090" -e REDIS_HOST="172.16.160.106"  -v /home/portal/upload:/home/portal/upload   1900cbf55a4c
  • 相关阅读:
    Centos7下zabbix部署(三)自定义监控项
    Centos下zabbix部署(二)agent安装并设置监控
    Centos7下yum安装zabbix-server的部署(一)
    java 动态代理
    java 签名类 Signature
    java 证书 .cer 和 .pfx
    Mustache(3)
    Mustache(2)
    Mustache 使用心得总结
    微信小程序开发
  • 原文地址:https://www.cnblogs.com/wangmo/p/9072131.html
Copyright © 2011-2022 走看看