概述

搭建一个私有仓库

harbor介绍

harbor是一个开源的docker容器仓库,由下面几个组件组成

+ proxy:用来接收docker客户端和浏览器端的请求,并且把请求转发给后端的服务

+ registry:就是仓库,用来存储镜像的,

+ 核心服务:提供web ui,数据库,token认证,webhook等功能

+ 日志服务

  • database:用来存储核心服务的一些数据

vmware出品,支持下面几种部署方式

  • 在线安装
  • 离线安装
  • ova安装,这个直接在vcenter上导入就可以了

官方最小配置

  • 2个cpu
  • 4g内存
  • 40g硬盘,因为是存储镜像的所以推荐硬盘大点

官方安装帮助

https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md

Software

Software Version Description
Python version 2.7 or higher Note that you may have to install Python on Linux distributions (Gentoo, Arch) that do not come with a Python interpreter installed by default
Docker engine version 17.03.0-ce+ or higher For installation instructions, please refer to: https://docs.docker.com/engine/installation/
Docker Compose version 1.18.0 or higher For installation instructions, please refer to: https://docs.docker.com/compose/install/
Openssl latest is preferred Generate certificate and keys for Harbor

Network ports


Port Protocol Description
443 HTTPS Harbor portal and core API will accept requests on this port for https protocol
4443 HTTPS Connections to the Docker Content Trust service for Harbor, only needed when Notary is enabled
80 HTTP Harbor portal and core API will accept requests on this port for http protocol

安装docker:

https://docs.docker.com/install/linux/docker-ce/centos/

可选安装docker方式1: curl -fsSL get.docker.com -o get-docker.sh

  • 移除旧版
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
安装依赖包  
```
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
```
添加源  
```
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
```

安装和启动

sudo yum-config-manager --enable docker-ce-nightly

sudo yum install docker-ce docker-ce-cli containerd.io

sudo systemctl start docker

docker-compose安装:

  • 安装和测试docker-compose

    官网文档 https://docs.docker.com/compose/install/

    下载docker-compose可执行文件

    sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

    设可执行权限

    sudo chmod +x /usr/local/bin/docker-compose

    软连接到/usr/bin

    sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

    查看安装是否成功

    docker-compose --version

安装步骤:

  • Download the installer:

    下载离线安装包:

    https://github.com/goharbor/harbor/releases

    Online installer:

    $ tar xvf harbor-online-installer-<version>.tgz

    Offline installer:

    $ tar xvf harbor-offline-installer-<version>.tgz

  • Configure harbor.cfg/harbor.yml(新版已经改成harbor.yml);

    • 修改配置,协议,证书,管理员密码 

      hostname = reg.lvusyy.com

      ui_url_protocol = https

      ssl_cert = ./ssl/reg.lvusyy.com.crt

      ssl_cert_key = ./ssl/reg.lvusyy.com.key

      harbor_admin_password = harbor12345
    • 生成配置文件  
      • 证书可以从 letsencrypt 生成免费的证书..(默认浏览器和工具都不会提示不安全警告的.)

        详情参考:https://github.com/Neilpang/acme.sh/wiki/说明

        关于配置:

      • 生成https证书(手动自签发的证书,没有根证书信任)

        参考 https://github.com/goharbor/harbor/blob/master/docs/configure_https.md

          #生成key  
        `openssl genrsa -out ca.key 4096`  

          #根据key生成ca.crt  

          openssl req -x509 -new -nodes -sha512 -days 3650 \
        -subj "/C=CN/ST=Hangzhou/L=Hangzhou/O=example/OU=Personal/CN=lvusyy.com" \
        -key ca.key \
        -out ca.crt
        1. Create your own Private Key:

          openssl genrsa -out reg.lvusyy.com.key 4096

        2. Generate a Certificate Signing Request:

          openssl req -sha512 -new

          -subj "/C=CN/ST=Hangzhou/L=Hangzhou/O=example/OU=Personal/CN=reg.lvusyy.com"

          -key reg.lvusyy.com.key

          -out reg.lvusyy.com.csr

           cat > v3.ext <<-EOF
          authorityKeyIdentifier=keyid,issuer
          basicConstraints=CA:FALSE
          keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
          extendedKeyUsage = serverAuth
          subjectAltName = @alt_names [alt_names]
          DNS.1=reg.lvusyy.com
          DNS.2=lvusyy
          DNS.3=harbor
          EOF

          openssl x509 -req -sha512 -days 3650

          -extfile v3.ext

          -CA ca.crt -CAkey ca.key -CAcreateserial

          -in reg.lvusyy.com.csr

          -out reg.lvusyy.com.crt

      • 导入docker镜像  

        sudo docker load < harbor.v1.8.0.tar.gz

      • 生成配置

      • ./prepare

  • Run install.sh to install and start Harbor;

  • 开始安装

    • #注意网络问题哦

      ./install  

      到此 harbor 已经安装完成了。
192.168.1.xx reg.lvusyy.com

你可以导入你的根证书让浏览器或wget 不报ssl警告

mkdir /usr/share/ca-certificates/harbor/

cp /media/makeit/Document/harborCa/ca.crt /usr/share/ca-certificates/harbor/

sudo update-ca-certificates

这样就ok了。

wget -q -O - https://reg.lvusyy.com

如果 curl 访问呢?

* Rebuilt URL to: https://reg.lvusyy.com/
* Trying 10.1.1.53...
* TCP_NODELAY set
* Connected to reg.lvusyy.com (10.1.1.53) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /home/makeit/anaconda3/ssl/cacert.pem
CApath: none

它使用 /home/makeit/anaconda3/ssl/cacert.pem ,我们把我们ca重定向进去就可以了呗。

转换格式 .cer 到 .pem

openssl x509 -inform der -in lvusyy.cer -out lvusyy.pem

追加到信任列表

cat lvusyy.pem >> /home/makeit/anaconda3/ssl/cacert.pem

妥了!

chrome呢,firefox,oprea呢

自己设置窗口导入即可。

enjoy!

使用harborv1.8.0-rc1 搭建docker私有镜像仓库的更多相关文章

  1. 基于 registry 搭建 Docker 私有镜像仓库

    今天主要介绍使用 registry 来搭建 Docker私有镜像仓库,方便在公司内部项目中使用,registry 也是 Docker 官方提供的一个镜像,操作也很简单. dockerhub: http ...

  2. 搭建docker 私有镜像仓库

    前期准备 服务器:centos 7.3 docker-ce: 18.06.1-ce docker-compose: 1.22.0 docker 安装 首先,更新系统 yum update yum up ...

  3. 使用Harbor搭建Docker私有镜像仓库

    Harbor介绍:https://goharbor.io/ 前置条件 需要安装了docker和docker-compose 下载Harbor 在harbor下载页(https://github.com ...

  4. 搭建Harbor私有镜像仓库--v1.5.1

     搭建Harbor私有镜像仓库--v1.5.1 1.介绍 Docker容器应用的开发和运行离不开可靠的镜像管理,虽然Docker官方也提供了公共的镜像仓库,但是从安全和效率等方面考虑,部署我们私有环境 ...

  5. 微服务架构 - 搭建docker本地镜像仓库并提供权限校验及UI界面

    搭建docker本地镜像仓库并提供权限校验及UI界面 docker本地镜像仓库的作用跟maven私服差不多,特别是公司级或者是小组级开发好的docker仓库可以上传到本地镜像仓库中,需要用时,直接从本 ...

  6. Docker 私有镜像仓库的搭建及认证

    DockerHub 为我们提供了很多官方镜像和个人上传的镜像,我们可以下载机构或个人提供的镜像,也可以上传我们自己的本地镜像,但缺点是: 由于网络的原因,从 DockerHub 下载和上传镜像速度可能 ...

  7. 容器技术之Docker私有镜像仓库docker-distribution

    在前边的博客中我们说到docker的架构由docker客户端.服务端以及仓库组成:docker仓库就是用来存放镜像的地方:其实docker registry我们理解为存放docker镜像仓库的仓库比较 ...

  8. 容器技术之Docker私有镜像仓库harbor

    前文我们聊到了docker的私有镜像仓库docker-distribution的搭建和简单的使用,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/13058338 ...

  9. 使用Nexus3构建Docker私有镜像仓库

    一.安装Nexus3 Nexus3是Sonatype提供的仓库管理平台,Nuexus Repository OSS3能够支持Maven.npm.Docker.YUM.Helm等格式数据的存储和发布:并 ...

随机推荐

  1. 将迁移学习用于文本分类 《 Universal Language Model Fine-tuning for Text Classification》

    将迁移学习用于文本分类 < Universal Language Model Fine-tuning for Text Classification> 2018-07-27 20:07:4 ...

  2. IntelliJ Idea清除Open Recent里面的项目列表

    2种方法清除IntelliJ Idea 中 Open Recent里面的项目列表 第一种方法: 如下图: Open Recent -> Manage Projects Recent Projec ...

  3. (十三)Activitivi5之流程控制网关:并行

    一.概念 所谓排他网关 顾名思义 执行到该网关,会有多条线路同时并行执行,当都执行完才继续执行后面的: 二. 案例 此时当“学生请假”任务节点完成之后,如下图此时有两个任务,必须等到两个任务都完成才会 ...

  4. (二十六)JavaBean

    一.定义 1 JavaBean是一个遵循特定写法的Java类,它通常具有如下特点: 这个Java类必须具有一个无参的构造函数 属性必须私有化. 私有化的属性必须通过public类型的方法暴露给其它程序 ...

  5. MVC的12种ActionResult介绍以及应用示例【转】

    一.介绍 1.ViewResult 表示一个视图结果,它根据视图模板产生应答内容.对应得Controller方法为View. 2.PartialViewResult 表示一个部分视图结果,与ViewR ...

  6. sqlyog无操作一段时间后重新操作会卡死问题

    在使用 sqlyog 的过程中,遇到了这种情况:打开一个连接,进行了一些操作之后,过一段时间没有操作,然后再来操作会卡死一段时间,等一段时间后操作完成了继续进行其它操作,又很流畅了.但是过一段时间不操 ...

  7. Linux 命令实战

    命令登录 ssh  UserName@RemoteIP ssh  seemmo@192.168.0.1 统计文件.目录的数量 统计当前目录下文件数量:ls  -l  |  grep  "^- ...

  8. 3、Concurrenthashmap实现原理(JDK版本1.7)

    (1)结构图: l  ConcurrentHashMap中的数据结构 ConcurrentHashMap是由Segment数组结构和HashEntry数组结构组成.Segment实际继承自可重入锁(R ...

  9. sqlyog 如何导出建表语句

    真傻了,这个问题弄了半天. 解决 点击表名后,在右侧的信息栏里面有啊: PS - 个人博客链接:sqlyog 如何导出建表语句

  10. js检测是不是数字

    function isValueNumber(value) { var reg = (/(^-?[0-9]+\.{1}\d+$)|(^-?[1-9][0-9]*$)|(^-?0{1}$)/); var ...