zoukankan      html  css  js  c++  java
  • 物联网架构成长之路(44)-Docker私有仓库Harbor

    0. 前言

      安装docker、docker-compose,这些在我以前的博客讲过,这里就不继续说明了,有需要的可以参考我之前的博客。
      https://www.cnblogs.com/wunaozai/p/9936306.html

    1. 安装harbor
      到这个下载页 https://github.com/goharbor/harbor/releases

    1 wget https://github.com/goharbor/harbor/releases/download/v1.9.2/harbor-online-installer-v1.9.2.tgz
    2 tar -zxvf harbor-online-installer-v1.9.2.tgz
    3 cd harbor

      然后修改harbor.yml
      hostname 改为本机IP地址
      port 改为 指定端口
      harbor_admin_password 修改登录密码
      data_volume 修改存放路径

    ./install.sh

      这个过程会比较耗时间,预计要下载1G的东西,是通过docker pull拉取的,那个仓库源,要改为aliyuncs。换这个源也可以https://mirrors.ustc.edu.cn/help/dockerhub.html,实在不行就多试几次。
      下载完成后效果

      通过帐号密码登录 http://172.16.23.203:20000

    2. 测试Harbor

      另外一台机器登录私有docker 仓库

    docker login 172.16.23.203

      然后会发现出现登录失败,是因为默认docker是会以https方式登录系统。我们需要在/etc/docker/daemon.json 里面增加如下信息

    1 {
    2     "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"],
    3     "insecure-registries": ["http://172.16.23.203:20000"]
    4 }

      重新加载配置

    1 systemctl daemon-reload
    2 systemctl restart docker

      在管理界面,创建一个dev的项目,也有说明怎么上传Image镜像

      找一个hello-world试验一下

     1 #登录
     2 docker login 172.16.23.203:20000
     3 #下载官方库
     4 docker pull hello-world:latest
     5 #打标签
     6 docker tag hello-world:latest 172.16.23.203:20000/dev/hello-world:latest
     7 #推送到远程
     8 docker push 172.16.23.203:20000/dev/hello-world:latest
     9 #删除镜像
    10 docker rmi 172.16.23.203:20000/dev/hello-world:latest
    11 #重新拉取镜像
    12 docker pull 172.16.23.203:20000/dev/hello-world:latest

      有了这个harbor之后,现在很多以前下载的Image都可以备份到私有仓库里面。每次有新的库,都只需要下载一次。

    本文地址: https://www.cnblogs.com/wunaozai/p/11822341.html

    本系列目录:https://www.cnblogs.com/wunaozai/p/8067577.html

    个人主页:https://www.wunaozai.com/

  • 相关阅读:
    CodeForces 55D Beautiful numbers(数位dp+数学)
    hdu 2089 不要62(数位dp入门)
    Git版本控制
    Git初始化-添加提交以及查看状态
    linux-高并发与负载均衡-lvs-3种模型推导
    Scrapy中选择器的用法
    Scrapy命令行详解
    Scrapy框架基本用法讲解
    MaxCompute教程
    Scrapy安装报错
  • 原文地址:https://www.cnblogs.com/wunaozai/p/11822341.html
Copyright © 2011-2022 走看看