美文网首页
Jenkins-docker-svn 自动化部署 2018-1

Jenkins-docker-svn 自动化部署 2018-1

作者: 飘向未来 | 来源:发表于2018-12-04 14:55 被阅读0次
    安装 这个插件可以   new a maven project   


    image_version=`date +%Y%m%d%H%M`;

    docker tag yourself/spring-boot-demo:latest yourself/spring-boot-demo:$image_version

    mvn clean package docker:build

    if docker ps | grep -i sbdemo; then

    docker stop sbdemo

    fi

    if docker ps -a | grep -i sbdemo; then

    docker rm sbdemo

    fi

    docker run --name sbdemo -v /home/yourself:/logs -dit -p 8004:8004 yourself/spring-boot-demo

    下面奉上脚本

    推送镜像脚本
    docker tag yourself/spring-boot-demo ip:5000/yourself/spring-boot-demo

    docker push ip:5000/yourself/spring-boot-demo

    curl ip:5000/v2/_catalog

    拉取并运行镜像

    if docker ps | grep -i sbdemo ; then

    docker stop sbdemo

    fi

    if docker ps -a | grep -i sbdemo ; then

    docker rm sbdemo

    fi

    if docker images | grep -i ip:5000/yourself/spring-boot-demo ; then

    docker rmi ip:5000/yourself/spring-boot-demo

    fi

    docker pull ip:5000/yourself/spring-boot-demo

    docker run --name sbdemo -v /home/yourself:/logs -dit -p 8004:8004 ip:5000/yourself/spring-boot-demo

    相关文章

      网友评论

          本文标题:Jenkins-docker-svn 自动化部署 2018-1

          本文链接:https://www.haomeiwen.com/subject/ezcpcqtx.html