一:用途###

Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器。

二:安装docker-ce###

环境:阿里云轻量应用服务器CentOS 7.3

这里通过yum Docker源仓库安装:

①安装yum 管理依赖包

sudo yum install-y yum-utils device-mapper-persistent-data lvm2

②添加Docker 源仓库

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

③安装Docker CE

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

三:安装docker-compose###

参考这篇博客:https://www.cnblogs.com/wucaiyun1/p/11811112.html

四:安装harbor###

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

①下载harbor

wget https://storage.googleapis.com/harbor-releases/harbor-offline-installer-v1.6.1.tgz

或者到github releases下载

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

-------------------------------------------------------------------http方式-------------------------------------------------------------------

②配置安装(http方式)

[root@iZuf6hcb8yumasfp52oemxZ ailala]# tar -xf harbor-offline-installer-v1.6.1.tgz
[root@iZuf6hcb8yumasfp52oemxZ ailala]# cd harbor
[root@iZuf6hcb8yumasfp52oemxZ harbor]# vi harbor.yml



-------------------------------------------------------------------http方式-------------------------------------------------------------------

-------------------------------------------------------------------https方式-------------------------------------------------------------------

②配置安装(https方式)

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

Getting Certificate Authority####

openssl genrsa -out ca.key 4096
openssl req -x509 -new -nodes -sha512 -days 3650 \
-subj "/C=CN/ST=Shanghai/L=Shanghai/O=example/OU=Personal/CN=fixedbug.work" \
-key ca.key \
-out ca.crt

Getting Server Certificate####

  1. Create your own Private Key:
openssl genrsa -out fixedbug.work.key 4096
  1. Generate a Certificate Signing Request:
openssl req -sha512 -new \
-subj "/C=CN/ST=Shanghai/L=Shanghai/O=example/OU=Personal/CN=fixedbug.work" \
-key fixedbug.work.key \
-out fixedbug.work.csr
  1. Generate the certificate of your registry host:
cat > v3.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names [alt_names]
DNS.1=fixedbug.work
DNS.2=fixedbug
DNS.3=hostname
EOF
openssl x509 -req -sha512 -days 3650 \
-extfile v3.ext \
-CA ca.crt -CAkey ca.key -CAcreateserial \
-in fixedbug.work.csr \
-out fixedbug.work.crt

Configuration and Installation####

  1. Configure Server Certificate and Key for Harbor
  cp yourdomain.com.crt /data/cert/
cp yourdomain.com.key /data/cert/
  1. Configure Server Certificate, Key and CA for Docker

    Convert server yourdomain.com.crt to yourdomain.com.cert:
openssl x509 -inform PEM -in fixedbug.work.crt -out fixedbug.work.cert

Delpoy yourdomain.com.cert, yourdomain.com.key, and ca.crt for Docker:

  cp yourdomain.com.cert /etc/docker/certs.d/yourdomain.com/
cp yourdomain.com.key /etc/docker/certs.d/yourdomain.com/
cp ca.crt /etc/docker/certs.d/yourdomain.com/
/etc/docker/certs.d/
└── yourdomain.com:port
├── yourdomain.com.cert <-- Server certificate signed by CA
├── yourdomain.com.key <-- Server key signed by CA
└── ca.crt <-- Certificate authority that signed the registry certificate
  1. Configure Harbor



    -------------------------------------------------------------------https方式-------------------------------------------------------------------
[root@iZuf6hcb8yumasfp52oemxZ harbor]# ./prepare
[root@iZuf6hcb8yumasfp52oemxZ harbor]# ./install

③登录

五:上传镜像到harbor仓库###

在本机配置harbor仓库http可信

/etc/docker/daemon.json中添加“"insecure-registries":["reg.slito.com"]”,不然会报错,默认是走https的,重启docker;

登录harbor仓库

[root@iZuf6hcb8yumasfp52oemxZ harbor]# docker login fixedbug.work:88
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

上传镜像

[root@iZuf6hcb8yumasfp52oemxZ harbor]# docker tag mysql:8 fixedbug.work:88/library/mysql:v1
[root@iZuf6hcb8yumasfp52oemxZ harbor]# docker push fixedbug.work:88/library/mysql:v1
The push refers to repository [fixedbug.work:88/library/mysql]
55f5c7d40658: Pushed
8d0c9963a6ad: Pushed
17b62e7a629c: Pushed
8eae701cdfcf: Pushing 31.11MB/341.1MB
d4078c1b9fdb: Pushed
8eae701cdfcf: Pushed
2a9aab74013a: Pushing 33.62MB/44.77MB
414373ffccb4: Pushed
2a9aab74013a: Pushed
51734435c93c: Pushed
5a8a245abd1c: Pushed
99b5261d397c: Pushing 23.78MB/55.34MB 99b5261d397c: Pushed
v1: digest: sha256:a65e1689b806ccb757887565a3c1d8e7467f14621012d472076cad4117eb06f3 size: 2828
[root@iZuf6hcb8yumasfp52oemxZ harbor]#

在harbor中查看

六:下载harbor中的镜像###

[root@iZuf6hcb8yumasfp52oemxZ ~]# docker rmi fixedbug.work:88/library/mysql:v1
Untagged: fixedbug.work:88/library/mysql:v1
Untagged: fixedbug.work:88/library/mysql@sha256:a65e1689b806ccb757887565a3c1d8e7467f14621012d472076cad4117eb06f3
[root@iZuf6hcb8yumasfp52oemxZ ~]# docker images | grep mysql
mysql 8 d435eee2caa5 12 days ago 456MB
[root@iZuf6hcb8yumasfp52oemxZ ~]# docker pull fixedbug.work:88/library/mysql:v1
v1: Pulling from library/mysql
Digest: sha256:a65e1689b806ccb757887565a3c1d8e7467f14621012d472076cad4117eb06f3
Status: Downloaded newer image for fixedbug.work:88/library/mysql:v1
fixedbug.work:88/library/mysql:v1
[root@iZuf6hcb8yumasfp52oemxZ ~]# docker images | grep mysql
mysql 8 d435eee2caa5 12 days ago 456MB
fixedbug.work:88/library/mysql v1 d435eee2caa5 12 days ago 456MB

踩坑记录:域名只是用来替代IP的,没有备案会封锁对应IP的80和433端口,这个IP必须是国内的才行。如果域名指向国外IP,备案还是不备案都不妨碍80和433端口的使用。

【Docker】企业级镜像仓库harbor的搭建(http/https)及使用的更多相关文章

  1. Docker 企业级镜像仓库 Harbor 的搭建与维护

    目录 一.什么是 Harbor 二.Harbor 安装 2.1.Harbor 安装环境 2.2.Harbor安装 2.3 配置HTTPS 三.Harbor 的使用 3.1.登录Harbor并使用 3. ...

  2. Docker: 企业级镜像仓库Harbor的使用

    上一节,演示了Harbor的安装部署 这次我们来讲解 Harbor的使用. 我们需要了解到: 1. 如何推镜像到镜像仓库 2. 如何从镜像仓库拉取镜像 3. 如何运行从私有仓库拉取的镜像 # 查看 h ...

  3. 企业级Docker容器镜像仓库Harbor的搭建

    Harbor简述 Habor是由VMWare公司开源的容器镜像仓库.事实上,Habor是在Docker Registry上进行了相应的企业级扩展,从而获得了更加广泛的应用,这些新的企业级特性包括:管理 ...

  4. docker企业级镜像仓库Harbor管理

    Harbor概述 Harbor是由VMWare公司开源的容器镜像仓库.事实上,Harbor是在Docker Registry上进行了相应的企业级扩展,从而获得了更加广泛的应用,这些新的企业级特性包括: ...

  5. Docker: 企业级镜像仓库Harbor部署(http)

    Harbor离线安装包下载地址:https://github.com/goharbor/harbor Docker compose(安装harbor需要用到docker compose)下载地址:ht ...

  6. Docker企业级镜像仓库harbor(vmware 中国团队)

    第一步:安装docker和docker-compose 第二步:下载harbor-offline-installer-v1.3.0.tgz 第三步:上传到/opt,并解压 第四步:修改harbor.c ...

  7. docker企业级镜像仓库harbor

    第一步:安装docker和docker-compose 第二步:下载harbor-offine-installer-v1.5.1.tgz 第三步:上传到/opt,并解压 第四步:修改harbor.cf ...

  8. 企业级镜像仓库harbor搭建

    企业级镜像仓库harbor搭建 一.    Harbor概述 VMware公司最近开源了企业级Registry项目Harbor,其的目标是帮助用户迅速搭建一个企业级的Docker registry 服 ...

  9. 企业级镜像仓库 harbor

    企业级镜像仓库 harbor 前言 a. 本文主要为 Docker的视频教程 笔记. b. 环境为 CentOS 7.0 云服务器 c. 上一篇:跨 Docker 宿主机网络 overlay 类型 h ...

随机推荐

  1. 从零学React Native之12 组件的生命周期

    一个React Native组件从它被加载,到最终被卸载会经历一个完整的生命周期.所谓生命周期,就是一个对象从开始生成到最后消亡所经历的状态,理解生命周期,是合理开发的关键. ES6语法和之前的ES5 ...

  2. RedHat6.2离线安装vncserver

    准备安装包 tigervnc-server-1.1.0-5.el6_4.1.x86_64.rpm pixman-0.32.8-1.el6.x86_64.rpm pixman-devel-0.32.8- ...

  3. 洛谷 P1829 [国家集训队]Crash的数字表格 / JZPTAB(莫比乌斯反演)

    题意:求$\sum_{i=1}^{n}\sum_{j=1}^{m}lcm(i,j)$. 开始开心(自闭)化简: $\sum_{i=1}^{n}\sum_{j=1}^{m}lcm(i,j)$ =$\su ...

  4. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十六章:实例化和截头锥体裁切

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十六章:实例化和截头锥体裁切 代码工程地址: https://git ...

  5. 【数据库】sql2008卸载和默认实例的删除 标签: 数据库 2014-11-16 15:15 5878人阅读 评论(30)

    在安装sql2008的时候,会碰到这一步,要求创建实例,可以选择默认实例和命名实例,如果是第一次安装的话,可以选择默认实例,但是如果是第二次甚至更多次安装的 话,很多时候会出现不能用默认实例,只能自己 ...

  6. tensorflow兼容处理 tensorflow.compat.v1

    https://www.wandouip.com/t5i183316/ 引言 原来引用过一个段子,这里还要再引用一次.是关于苹果的.大意是,苹果发布了新的开发语言Swift,有非常多优秀的特征,于是很 ...

  7. python 约束. 异常处理. MD5. 日志处理

    一.约束 1.抛异常 # # 项目经理写的 class Base: # # 对子类进行了约束. 必须重写该方法 # # 以后上班了. 拿到公司代码之后. 发现了NotImplementedError ...

  8. Python基础:09函数式编程

    Python支持一些函数式编程的特性.比如lambda. map().reduce().filter()函数. 一:匿名函数与lambda Python可以用lambda 关键字创造匿名函数.匿名函数 ...

  9. @loj - 2496@ 「AHOI / HNOI2018」毒瘤

    目录 @description@ @solution@ @accepted code@ @details@ @description@ 从前有一名毒瘤. 毒瘤最近发现了量产毒瘤题的奥秘.考虑如下类型的 ...

  10. mysql 中 DATE_ADD函数和 DATE_SUB函数用法

    mysql 中 DATE_ADD(date,INTERVAL expr type) 和 DATE_SUB(date,INTERVAL expr type) 这些函数执行日期运算. date 是一个 D ...