zoukankan      html  css  js  c++  java
  • harbor私有仓库搭建

    一、准备环境

     二、安装docker

    2.1、准备docker-ce安装镜像

    [root@localhost ~]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo

    2.2、安装docker-ce

    [root@localhost ~]# yum list docker-ce --showduplicates | sort -r
    [root@localhost ~]# yum -y install docker-ce-18.06.1.ce-3.el7
    [root@localhost ~]# systemctl start docker
    [root@localhost ~]# systemctl status docker
    
    [root@localhost ~]# docker --version
    Docker version 18.06.1-ce, build e68fc7a

    2.3、镜像加速

    [root@localhost ~]#  curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
    [root@localhost ~]# cat /etc/docker/daemon.json
    {
        "registry-mirrors": ["http://f1361db2.m.daocloud.io"]
    }
    [root@localhost ~]# systemctl restart docker

    三、Harbor安装

    3.1、安装docker-compose

    [root@localhost ~]# yum -y install docker-compose
    [root@localhost ~]# docker-compose -version
    docker-compose version 1.18.0, build 8dd22a9

    3.2、安装harbor

    3.2.1 准备harbor压缩包,harbor-offline-installer-v1.8.3.tgz

    下载地址:https://github.com/vmware/harbor/releases

    3.2.2 解压安装

    [root@localhost ~]# tar zxf harbor-offline-installer-v1.8.3.tgz
    [root@localhost ~]# cd harbor/
    
    [root@localhost harbor]# vim  harbor.yml
    hostname: 172.16.68.237
    
    [root@localhost harbor]# ./install.sh
    Creating network "harbor_harbor" with the default driver
    Creating harbor-log ... done
    Creating harbor-adminserver ... done
    Creating registry           ... done
    Creating harbor-db          ... done
    Creating redis              ... done
    Creating registryctl        ... done
    Creating harbor-core        ... done
    Creating harbor-portal      ... done
    Creating harbor-jobservice  ... done
    Creating nginx              ... done
     
    ✔ ----Harbor has been installed and started successfully.----
     
    Now you should be able to visit the admin portal at http://10.0.0.100.
    For more details, please visit https://github.com/goharbor/harbor .

    四、登陆web页面

    地址  http://ip:80   ,  用户密码  admin/Harbor12345

    五、添加主机信任

    [root@localhost]# cat /etc/docker/daemon.json
    {
        "registry-mirrors": ["http://f1361db2.m.daocloud.io"],
        "insecure-registries": ["172.16.68.237"]
    }
    [root@localhost ~]# systemctl restart docker.service

    六、推送测试

    6.1 登陆harbor

    [root@localhost ]# docker login 172.16.68.237
    Username: admin
    Password:
    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

    6.2下载一个测试nginx镜像

    [root@localhost ~]# docker search nginx

    [root@localhost ~]# docker pull nginx

    6.3 给下载下来得镜像打标签

    [root@localhost ~]# docker tag nginx  172.16.68.237/library/nginx:v1
    [root@localhost ~]# docker image list |grep nginx

     6.4 上传镜像

    [root@localhost ~]# docker push 172.16.68.237/library/nginx:v1
    The push refers to repository [172.16.68.237/library/nginx]
    84978778128d: Pushed 
    022b3c854a6f: Pushed 
    edf3aa290fb3: Pushed 
    v1: digest: sha256:e80c965b612e57bbd879ed78c9c5f64c427c9bbe8e3dac03902a5efbc73e00bd size: 953

    6.5 下载镜像

    [root@localhost ~]# docker pull 172.16.68.237/library/nginx:v1

     参考:https://www.cnblogs.com/xuewenlong/p/12886671.html

     

  • 相关阅读:
    安全购买数码相机的诀窍!(1)
    获得网卡MAC地址和IP地址
    用Asp.net实现基于XML的留言簿之二
    安全购买数码相机的诀窍!(2)
    使用Flash读取COOKIE
    数码常识:CCD的原理
    ACE 5.5 Make in RedHat AS 4 Update 4 Issue
    Eclipse Plugins 开发 (1)
    RedHat AS4 Update4 DNS (bind 9) 配置
    Maven2 & Continuum 持续整合 (1)
  • 原文地址:https://www.cnblogs.com/lina-2159/p/14041372.html
Copyright © 2011-2022 走看看