美文网首页
配置使用 harbor 镜像仓库

配置使用 harbor 镜像仓库

作者: Lucie_xxm | 来源:发表于2019-08-13 10:24 被阅读0次

    配置docker镜像仓库

    vi /etc/docker/daemon.json 
    

    提加镜像私服仓库地址

    {
      "registry-mirrors": [
        "https://registry.docker-cn.com"
      ],
      "insecure-registries": [
        "120.79.10.212"
      ],
      "exec-opts": ["native.cgroupdriver=systemd"]
    }
    

    重启docker 使配置生效

    systemctl daemon-reload
    systemctl restart docker
    

    查看是否配置成功

    docker info
    
    Insecure Registries:
     120.79.10.212
     127.0.0.0/8
    Registry Mirrors:
    

    登陆镜像仓库

    docker login 120.79.10.212
    

    登陆成功

    [root@xxm harbor]# docker login 120.79.10.212
    Authenticating with existing credentials...
    WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
    Configure a credential helper to remove this warning. See
    https://docs.docker.com/engine/reference/commandline/login/#credentials-store
    
    Login Succeeded
    

    在没有配置镜像私服 使用docker login登陆会提示

    新建项目组

    新建项目

    点进相应的项目组 在推送镜像 有相应的docker tagdocker push的提示密令

    测试镜像仓库

    ## 拉取nginx镜像 
    docker pull nginx:latst
    
    ## 查看镜像
    docker images
    
    ## 给镜像打tag 标签
    docker tag nginx:latest 120.79.10.212/xxm/nginx:latest
    
    ## 推送镜像
    docker push 120.79.10.212/xxm/nginx:latest
    
    The push refers to repository [120.79.10.212/xxm/nginx]
    fe6a7a3b3f27: Pushed 
    d0673244f7d4: Pushing [==============>                                    ]  16.48MB/56.65MB
    d0673244f7d4: Pushed 
    d8a33133e477: Pushed 
    

    查看镜像

    验证镜像仓库 删除本地镜像再重新拉取

    docker rmi nginx 
    
    docker pull  120.79.10.212/xxm/nginx
    

    相关文章

      网友评论

          本文标题:配置使用 harbor 镜像仓库

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