Docker私有仓库Harbor部署与使用
一、harbor介绍
Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器。
由下面几个组件组成:
- proxy:nginx前端代理,主要是分发前端页面ui访问和镜像上传和下载流量
- registry:镜像仓库,负责存储镜像文件
- 核心服务:提供web ui,数据库,token认证,webhook等功能
- 日志服务
- database:用来存储核心服务的一些数据
因为是vmware出品的,所以支持下面几种部署方式
- 在线安装
- 离线安装
- ova安装,这个直接在vcenter上导入就可以了
官方最小配置
- 2个cpu
- 4g内存
- 40g硬盘,因为是存储镜像的所以推荐硬盘大点
二、搭建过程
Install Docker CE
root@localhost:~# apt-get update
root@localhost:~# apt-get install apt-transport-https ca-certificates software-properties-common curl
root@localhost:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg |sudo apt-key add -
root@localhost:~# apt-key fingerprint 0EBFCD88
root@localhost:~# add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
root@localhost:~# apt-get update
root@localhost:~# apt-get install docker-ce
Install Docker-compose
root@localhost:~# curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
root@localhost:~# chmod +x /usr/local/bin/docker-compose
#查看版本
root@localhost:~# docker --version
Docker version 18.09., build 4d60db4
root@localhost:~# docker-compose --version
docker-compose version 1.22., build f46880fe
Install harbor
root@localhost:~# wget https://storage.googleapis.com/harbor-releases/release-1.6.0/harbor-offline-installer-v1.6.0.tgz
root@localhost:~# tar -zxvf harbor-offline-installer-v1.6.0.tgz
#编辑配置文件
root@localhost:~# cd harbor/
root@localhost:~/harbor# vim harbor.cfg
hostname = 114.112.34.27
project_creation_restriction = adminonly
#Python环境
root@localhost:~/harbor# apt-get install python
root@localhost:~/harbor# export LC_ALL=C
root@localhost:~/harbor# ln -s /usr/bin/python3 /usr/bin/python
#安装服务
root@localhost:~/harbor# ./install.sh
看到以下内容,说明安装成功:
启动服务:
root@localhost:~/harbor# docker-compose start
Starting log ... done
Starting registry ... done
Starting postgresql ... done
Starting adminserver ... done
Starting ui ... done
Starting redis ... done
Starting jobservice ... done
Starting proxy ... done root@localhost:~/harbor# docker-compose ps
Name Command State Ports
-------------------------------------------------------------------------------------------------------------------------------------
harbor-adminserver /harbor/start.sh Up (healthy)
harbor-db /entrypoint.sh postgres Up (healthy) /tcp
harbor-jobservice /harbor/start.sh Up
harbor-log /bin/sh -c /usr/local/bin/ ... Up (healthy) 127.0.0.1:->/tcp
harbor-ui /harbor/start.sh Up (healthy)
nginx nginx -g daemon off; Up (healthy) 0.0.0.0:->/tcp, 0.0.0.0:->/tcp, 0.0.0.0:->/tcp
redis docker-entrypoint.sh redis ... Up /tcp
registry /entrypoint.sh /etc/regist ... Up (healthy) /t
配置HTTPS
##如果不做HTTPS,只需将hostname设置为IP,protocol改为HTTP即可,也不必生成CA
root@localhost:~/harbor# vi harbor.cfg
#创建目录
root@localhost:~/harbor# mkdir -p /data/cert/
#生成ca证书和签名
root@localhost:~/harbor# openssl genrsa -out /data/cert/ca.key
root@localhost:~/harbor# openssl req -x509 -new -nodes -key /data/cert/ca.key -subj "/CN=test.harbor.com" -days -out /data/cert/ca.crt
#启动服务
root@localhost:~/harbor# ./prepare
root@localhost:~/harbor# docker-compose down
root@localhost:~/harbor# docker-compose up -d
测试
修改本地host,添加一行内容
114.112.34.27 test.harbor.com 在浏览器中访问
http://test.harbor.com/
默认用户名/密码:admin/Harbor12345
登录成功后会看到如下页面:
添加项目:
进入此项目,可以看到推送镜像的命令:
删除项目:
确认项目不再使用时,选中项目,点击删除
点击删除:
在服务器进行测试
修改本地Docker默认仓库,指向Harbor
root@localhost:/data/cert# cp ca.crt /usr/local/share/ca-certificates/
root@localhost:/data/cert# update-ca-certificates
#修改docker配置文件,指向Harbor
root@localhost:~/harbor# vi /etc/default/docker
#添加一行内容
DOCKER_OPTS="--insecure-registry=test.harbor.com"
#重启docker服务
root@localhost:~# service docker restart
将本地Ubuntu镜像上传至Harbor
#将本地镜像打一个tag
root@localhost:~# docker tag ubuntu:16.04 test.harbor.com/paas/ubuntu:v1.
#推送到Harbor上
root@localhost:~/harbor# docker push test.harbor.com/paas/ubuntu:v1.
下载Harbor镜像至本地
root@localhost:~/harbor# docker pull test.harbor.com/paas/ubuntu:v1.
v1.: Pulling from paas/ubuntu
Digest: sha256:078d30763ae6697b7d55e49f4cb9e61407abd2137cafb5625f131aa47c1a47af
Status: Downloaded newer image for test.harbor.com/paas/ubuntu:v1.
Docker私有仓库Harbor部署与使用的更多相关文章
- docker 镜像仓库 Harbor 部署 以及 跨数据复制
docker 镜像仓库 Harbor 部署 跨数据复制 Harbor 是 Vmwar 公司开源的 企业级的 Docker Registry 管理项目 它主要 提供 Dcoker Registry 管理 ...
- docker开源仓库Harbor部署笔记
Harbor介绍Harbor是Vmvare团队开发的开源企业级registry仓库,相比docker官方拥有更丰富的权限权利和完善的架构设计,适用大规模docker集群部署提供仓库服务.项目地址:ht ...
- docker 私有仓库 harbor docker-compose
c创建docker私有仓库 docker pull registry:2.1.1 mkdir /opt/registry#mkdir /var/lib/registry docker run -d - ...
- 微服务探索之路03篇-docker私有仓库Harbor搭建+Kubernetes(k8s)部署私有仓库的镜像
❝ 目录: 微服务探索之路01篇.net6.0项目本地win10系统docker到服务器liunx系统docker的贯通 微服务探索之路02篇liunx ubuntu服务器部署k8s(kubernet ...
- 企业级Docker私有仓库Harbor
一.Harbor简介 1.Harbor介绍 Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器,通过添加一些企业必需的功能特性,例如安全.标识和管理等,扩展了开源Docke ...
- Docker 私有仓库 Harbor registry 安全认证搭建 [Https]
Harbor源码地址:https://github.com/vmware/harborHarbort特性:基于角色控制用户和仓库都是基于项目进行组织的, 而用户基于项目可以拥有不同的权限.基于镜像的复 ...
- 物联网架构成长之路(44)-Docker私有仓库Harbor
0. 前言 安装docker.docker-compose,这些在我以前的博客讲过,这里就不继续说明了,有需要的可以参考我之前的博客. https://www.cnblogs.com/wunaozai ...
- 企业级Docker镜像仓库Harbor部署与使用
yum install docker 官网地址:https://docs.docker.com/compose/install/ 运行此命令以下载Docker Compose的当前稳定版本 1 sud ...
- Docker镜像仓库Harbor部署
一.Harbor组件 组件 功能 harbor-adminserver 配置管理中心 harbor-db Mysql数据库 harbor-jobservice 负责镜像复制 harbor-log 记录 ...
随机推荐
- 进程—内存描述符(mm_struct)
http://blog.csdn.net/qq_26768741/article/details/54375524 前言 上一篇我们谈论了task_struct这个结构体,它被叫做进程描述符,内部成员 ...
- 【转】批处理命令 For循环命令详解!
批处理for命令详解FOR这条命令基本上都被用来处理文本,但还有其他一些好用的功能!看看他的基本格式(这里我引用的是批处理中的格式,直接在命令行只需要一个%号)FOR 参数 %%变量名 IN (相关文 ...
- ES6 初体验 —— gulp+Babel 搭建ES6环境
ES6已经火了好久了,我却一直没有在项目中尝试过使用ES6写代码,只是写过几个Demo,在大型项目中使用ES6这件事,我一直不太敢做.最近公司要求做一个小的H5活动专题,我想不如就在这个小项目中使用E ...
- 史上最简单的SpringCloud教程 | 第三篇: 服务消费者(Feign)
转载请标明出处: https://www.fangzhipeng.com/springcloud/2017/07/12/sc03-feign/ 本文出自方志朋的博客 最新Finchley版本请访问: ...
- JAVAWEB开发中过滤器的概述及使用
1.什么是过滤器? 过滤器是向WEB应用程序的请求和响应添加功能的WEB服务组件 2.过滤器的作用 1)可以统一的集中处理请求和响应 2)可以实现对请求数据的过滤 3.过滤器的工作方式 4.使用场合 ...
- 洛谷题解:P1209 【[USACO1.3]修理牛棚 Barn Repair】
原题传送门:https://www.luogu.org/problemnew/show/P1209 首先,这是一道贪心题. 我们先来分析它的贪心策略. 例如,样例: 4 50 18 3 4 6 ...
- glibc2.12升级至2.15
1.操作系统版本 [root@localhost ~]# cat /etc/redhat-release #CentOS release 6.9 (Final) 2.当前glibc版本 [root@l ...
- 有一段<script>代码,效果是点击<p>就会弹出信息,但是有的<p>点击会有效果,有的没有效果
问题:有一段<script>代码,效果是点击<p>就会弹出信息,但是有的<p>点击会有效果,有的没有效果 解决: 页面代码是至上而下执行的,如果你的这个标签在< ...
- juicer
function financingBodyTable(){ var jsonData = { FinancingBodyJSON:${relaListArr}//list数组 } var addMo ...
- Python学习笔记:Matplotlib(数据可视化)
Matplotlib是一个可以将数据绘制为图形表示的Python三方库,包括线性图(折线图,函数图).柱形图.饼图等基础而直观的图形,在平常的开发当中需要绘图时就非常有用了. 安装:pip insta ...