Harbor 是一个企业级的 Docker Registry,可以实现 images 的私有存储和日志统计权限控制等功能,并支持创建多项目(Harbor 提出的概念),基于官方 Registry V2 实现。
下面为搭建过程:
1、安装docker,过程略。
2、安装docker-compose
# curl -L https://github.com/docker/compose/releases/download/1.7.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose

3、配置SSL

# touch /etc/pki/CA/{index.txt,serial}
# echo 01 > /etc/pki/CA/serial
# (umask 077;openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048)

填写的信息:

Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:China
Locality Name (eg, city) [Default City]:Beijing
Organization Name (eg, company) [Default Company Ltd]:wts
Organizational Unit Name (eg, section) []:sysops
Common Name (eg, your name or your server's hostname) []:wts.com
Email Address []:admin@wts.com
# cat /etc/pki/CA/cacert.pem >> /etc/pki/tls/certs/ca-bundle.crt
# mkdir /app/ssl
# (umask 077;openssl genrsa -out /app/ssl/harbor.key 2048)
# openssl req -new -key /app/ssl/harbor.key -out /app/ssl/harbor.csr

填写的信息:

Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:China
Locality Name (eg, city) [Default City]:Beijing
Organization Name (eg, company) [Default Company Ltd]:wts
Organizational Unit Name (eg, section) []:sysops
Common Name (eg, your name or your server's hostname) []:wts.com
Email Address []:admin@wts.com Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
# openssl ca -in /app/ssl/harbor.csr -out /app/ssl/harbor.crt -days 3650
Using configuration from /etc/pki/tls/openssl.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 1 (0x1)
Validity
Not Before: May 19 17:46:32 2017 GMT
Not After : May 17 17:46:32 2027 GMT
Subject:
countryName = CN
stateOrProvinceName = China
organizationName = wts
organizationalUnitName = sysops
commonName = wts.com
emailAddress = admin@wts.com
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
12:71:95:95:F2:6E:FE:88:F0:3E:DF:24:1F:D6:01:E6:24:83:05:B5
X509v3 Authority Key Identifier:
keyid:B6:44:15:87:F1:3D:14:4E:7A:A0:BA:35:53:69:2D:3C:E9:9E:77:22 Certificate is to be certified until May 17 17:46:32 2027 GMT (3650 days)
Sign the certificate? [y/n]:y 1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated

docker创建根证书

# mkdir -p /etc/docker/certs.d/wts.com
# cp /etc/pki/CA/cacert.pem /etc/docker/certs.d/wts.com/ca.crt

重启docker

# systemctl daemon-reload
# systemctl restart docker

4、下载安装Harbor

# wget https://github.com/vmware/harbor/releases/download/v1.1.1-rc1/harbor-online-installer-v1.1.1-rc1.tgz
# tar xf harbor-online-installer-v1.1.1-rc1.tgz
# cd harbor
# vim harbor.cfg
hostname = wtx.com
ui_url_protocol = https
ssl_cert = /app/ssl/harbor.crt
ssl_cert_key = /app/ssl/harbor.key
# ./install.sh

[Step 0]: checking installation environment ...

Note: docker version: 17.05.0

Note: docker-compose version: 1.7.0

......

Creating harbor-log
Creating registry
Creating harbor-adminserver
Creating harbor-db
Creating harbor-ui
Creating harbor-jobservice
Creating nginx

常用操作

#启动
docker-compose start
#关闭
docker-compose stop #修改配置文件步骤
docker-compose down -v
vim harbor.cfg
./prepare
docker-compose up -d
docker-compose start
如果没有DNS,修改hosts文件
# cat >>/etc/hosts <<EOF
192.168.116.148 wts.com
EOF

测试

# docker login wts.com
Username: admin
Password: #密码为Harbor12345,harbor.cfg文件中配置
Login Succeeded
其他主机测试
# mkdir -p /etc/docker/certs.d/wts.com
# scp /etc/docker/certs.d/wts.com/ca.crt 192.168.116.147:/etc/docker/certs.d/wts.com/ca.crt
# /etc/init.d/docker restart

浏览器测试
访问https://192.168.116.148

上传镜像:
# docker tag centos wts.com/library/centos
# docker push wts.com/library/centos

查看:

日志:

创建用户

为项目添加成员

测试使用user1用户push镜像

查看日志

搭建企业级Docker Registry -- Harbor的更多相关文章

  1. 企业级Docker Registry —— Harbor搭建和使用

    本节内容: Harbor介绍 安装部署Harbor 环境要求 环境信息 安装部署harbor 配置harbor 配置存储 完成安装和启动harbor 访问Harbor 修改管理员密码 启动后相关容器 ...

  2. Kubernetes-5:搭建企业级私有仓库Harbor

    搭建企业级私有仓库Harbor 安装需求 python版本 >= 2.7 Docker引擎版本 >= 1.10 docker-compose版本 >= 1.6.0 安装环境 一.Py ...

  3. 使用docker搭建“企业级镜像仓库”Harbor

    一.前沿 docker的官方镜像仓库registry,功能比较单一,不太好用,特别是删除镜像操作,不够友好. Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器,通过添加一 ...

  4. Harbor搭建企业级docker仓库

    一. Harbor简介 1.1 Harbor介绍 Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器,通过添加一些企业必需的功能特性,例如安全.标识和管理等,扩展了开源Do ...

  5. 搭建私有Docker Registry

    Docker官方提供了用于搭建私有registry的镜像,并配有详细文档. 官方Registry镜像:https://hub.docker.com/_/registry 官方文档:https://do ...

  6. 搭建私服-docker registry

    Docke官方提供了Docker Hub网站来作为一个公开的集中仓库.然而,本地访问Docker Hub速度往往很慢,并且很多时候我们需要一个本地的私有仓库只供网内使用.Docker仓库实际上提供两方 ...

  7. Harbor 企业级 Docker Registry

    HarBor项目:https://github.com/vmware/harbor 下载:https://github.com/vmware/harbor/releases 安装文档:https:// ...

  8. Harbor快速搭建企业级Docker仓库

    Github: https://github.com/goharbor/harbor 改端口安装: https://www.cnblogs.com/huangjc/p/6420355.html 相关博 ...

  9. 企业级docker仓库Harbor部署

    1.安装环境下载离线安装包地址https://github.com/vmware/harbor/releases/yum install -y dockerpip install -i https:/ ...

随机推荐

  1. 【mysql】排序方法

    查询各科成绩前三名的记录,不考虑并列的情况: select a.course_id as 课程ID, a.score as 成绩, count(a.course_id) as 排名 from scor ...

  2. Docker和CI/CD实战

    一.CICD和DevOps 前面已经了解了CI/CD,其实CI/CD已经存在多年了,只是最近软件工程方面又提出了敏捷开发.DevOps,又把CI/CD炒火了. 那么什么是DevOps?DevOps和C ...

  3. anaconda 及python pip安装 类库等问题收集

    在win7下 通过anaconda安装jieba 报如下错误: 问题1:TypeError: parse() got an unexpected keyword argument 'transport ...

  4. HTML5--details活学活用

    这是补充HTML5基础知识的系列内容,其他为: 一.HTML5-- 新的结构元素 二.HTML5-- figure.time.details.mark 三.HTML5-- details活学活用 四. ...

  5. Macaca上手体验

    在研究了一段时间Appium后,尝试对另一个框架做实验——Macaca,阿里的开源测试框架,该框架不只适合移动端,同样适用于web端,可谓是方便的很啊~ 同时支持js.java.python.封装好的 ...

  6. python应用:生成简单二维码

    概述 \(\quad\)第一篇python的应用就打算写一写用python生成简单的二维码啦.因为二维码在日常生活中越来越常用了,部分博客也用二维码来用作打赏的工具.但是要提醒大家的是,千万不要乱扫街 ...

  7. lua编程之元表与元方法

    一. 前言 lua是一种非常轻量的动态类型语言,在1993年由由Roberto Ierusalimschy.Waldemar Celes 和 Luiz Henrique de Figueiredo等人 ...

  8. SpringBoot文件上传异常之提示The temporary upload location xxx is not valid

    原文: 一灰灰Blog之Spring系列教程文件上传异常原理分析 SpringBoot搭建的应用,一直工作得好好的,突然发现上传文件失败,提示org.springframework.web.multi ...

  9. Charles 抓包使用教程

    将 Charles 设置成系统代理 Charles 主界面介绍 过滤网络请求 截取 iPhone 上的网络封包 截取 Https 通讯信息 模拟慢速网络 修改网络请求内容 给服务器做压力测试 修改服务 ...

  10. Centos6.8操作防火墙

    设置防火墙iptables开放3306接口 在/etc/sysconfig下面有个iptables文件,在控制台输入命令 iptables -I INPUT -p tcp --dport 3306 - ...