• 推送docker镜像小脚本(包含修改daemon.json配置文件)


    #!/bin/bash
    set -e
    set -x
    cd /etc/docker
    sed -i '2i "insecure-registries":["172.19.12.84"],' /etc/docker/daemon.json
    grep "insecure-registries" /etc/docker/daemon.json
    if [ $? -eq 0 ]; then
        echo "succeed 配置信任网站 "
    else
        echo "failed 请检查配置"
    fi
    echo "重启docker服务"
    systemctl restart docker
    #5-12表示5月12日的镜像标签为v1
    echo "获取docker运行的容器名"
    container=`docker ps|grep -v ID|awk '{print $2}'`
    echo "给容器打新的tag"
    docker tag $container $container/5-12:v1
    echo "在项目中标记镜像"
    docker tag $container/5-12:v1 172.19.12.84/zj-school-project/$container/5-12:v1
    echo "登陆Harbor仓库"
    docker login 172.19.12.84 -u admin -p Harbor12345
    if [ $? -eq 0 ]; then
        echo "登陆Harbor仓库成功"
    else
        echo "登陆Harbor仓库失败"
    fi
    echo "开始推送指定镜像到Harbor仓库"
    docker push 172.19.12.84/zj-school-project/$container/5-12:v1
  • 相关阅读:
    FatMouse's Speed --hdu
    poj 1182--食物链 (并查集)
    HDU
    CodeForces
    LightOJ
    HDU2717:Catch That Cow(BFS 队列)
    HDU
    51Nod
    bash: ifconfig: command not found 解决办法--------仅供参考
    关于“ORA-01653: 表 SYS.AUD$ 无法通过 128 (在表空间 SYSTEM 中)
  • 原文地址:https://www.cnblogs.com/lichenghong/p/14762419.html
Copyright © 2020-2023  润新知