简介

Docker容器应用的开发和运行离不开可靠的镜像管理,虽然Docker官方也提供了公共的镜像仓库,但是从安全和效率等方面考虑,部署我们私有环境内的Registry也是非常必要的。

Harbor是由VMware公司开源的企业级的Docker Registry管理项目,它包括权限管理(RBAC)、LDAP、日志审核、管理界面、自我注册、

镜像复制和中文支持等功能。

离线安装

本次安装的前提是已经安装好了 docker 环境的服务器,centos 7

本次使用离线安装的方式进行安装。

首先安装依赖:

yum install docker-compose -y

目前Harbor托管在GitHub上,所以需要在GitHub上下载离线安装包。

地址: https://github.com/goharbor/harbor

在GitHub上下载 harbor 的离线安装包

[root@registory src]# wget https://storage.googleapis.com/harbor-releases/release-1.9.0/harbor-offline-installer-v1.9.1-rc1.tgz
--2019-10-12 11:17:14-- https://storage.googleapis.com/harbor-releases/release-1.9.0/harbor-offline-installer-v1.9.1-rc1.tgz
Resolving storage.googleapis.com (storage.googleapis.com)... 216.58.200.48, 2404:6800:4008:801::2010
Connecting to storage.googleapis.com (storage.googleapis.com)|216.58.200.48|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 619113214 (590M) [application/x-tar]
Saving to: ‘harbor-offline-installer-v1.9.1-rc1.tgz’ 100%[===================================================================================================================================================>] 619,113,214 5.13MB/s in 1m 53s 2019-10-12 11:19:07 (5.24 MB/s) - ‘harbor-offline-installer-v1.9.1-rc1.tgz’ saved [619113214/619113214]
[root@registory src]# ll harbor
total 607872
-rw-r--r-- 1 root root 622428100 Sep 27 14:52 harbor.v1.9.1.tar.gz
-rw-r--r-- 1 root root 5805 Sep 27 14:52 harbor.yml
-rwxr-xr-x 1 root root 5088 Sep 27 14:52 install.sh
-rw-r--r-- 1 root root 11347 Sep 27 14:52 LICENSE
-rwxr-xr-x 1 root root 1748 Sep 27 14:52 prepare

配置文件

[root@registory harbor]# egrep -v '#|^$' harbor.yml
hostname: 192.168.1.120 # 这里配置的监听地址,可以是域名
http:
port: 80 # 端口
harbor_admin_password: Harbor12345 # 配置admin用户的密码
database: # 配置数据库相关的信息
password: root123 # 数据库密码
max_idle_conns: 50
max_open_conns: 100
data_volume: /data # 镜像存放的目录
clair:
updaters_interval: 12
jobservice:
max_job_workers: 10
notification:
webhook_job_max_retry: 10
chart:
absolute_url: disabled
log:
level: info
local:
rotate_count: 50
rotate_size: 200M
location: /var/log/harbor # 日志目录
_version: 1.9.0
proxy:
http_proxy:
https_proxy:
no_proxy: 127.0.0.1,localhost,.local,.internal,log,db,redis,nginx,core,portal,postgresql,jobservice,registry,registryctl,clair
components:
- core
- jobservice
- clair

安装

直接执行解压后文件中的 install.sh 文件:

[root@registory harbor]# ./install.sh 

[Step 0]: checking installation environment ...

Note: docker version: 19.03.2

Note: docker-compose version: 1.18.0

[Step 1]: loading Harbor images ...
b80136ee24a4: Loading layer [==================================================>] 34.25MB/34.25MB
cad87ea2da29: Loading layer [==================================================>] 77.02MB/77.02MB
034ded39ed39: Loading layer [==================================================>] 3.072kB/3.072kB
f6ca716ef169: Loading layer [==================================================>] 59.9kB/59.9kB
baf21a4a14d3: Loading layer [==================================================>] 61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v1.9.1
... ... ...
... ... ... Creating registry ... done
Creating harbor-core ... done
Creating network "harbor_harbor" with the default driver
Creating nginx ... done
Creating redis ...
Creating harbor-db ...
Creating registryctl ...
Creating registry ...
Creating harbor-portal ...
Creating harbor-core ...
Creating harbor-jobservice ...
Creating nginx ... ✔ ----Harbor has been installed and started successfully.---- Now you should be able to visit the admin portal at http://192.168.1.120.
For more details, please visit https://github.com/goharbor/harbor .

查看

[root@registory harbor]# netstat -lntup | grep 80
tcp6 0 0 :::80 :::* LISTEN 3071/docker-proxy

访问测试 及 简单操作

直接访问 192.168.1.120

登陆

创建一个用户

创建一个测试仓库



创建测试仓库

测试上传和下载镜像

上传

注意: 默认情况下,docker使用的是https方式上传和下载,本次是用的是80端口,所以需要手动配置一下

[root@registory ~]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://0tb09e4d.mirror.aliyuncs.com"], # 镜像加速
"insecure-registries": ["registry.kubernetes"] # 这里列表中可配置多个
}

说明:上述中的registry.kubernetes手动写了hosts文件,所以需要注意,在需要使用该registry的机器上,都需要能解析。

[root@registory ~]# grep registry /etc/hosts
192.168.1.120 registry registry.kubernetes

修改镜像 tag 之后上传

首先登陆harbor,使用上面创建的tracy用户

[root@registory harbor]# docker login registry.kubernetes
Username: tracy
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

修改tag后上传

[root@registory harbor]# docker tag myweb:v0.3-5 registry.kubernetes/test/myweb:v0.3-5
[root@registory harbor]# docker push registry.kubernetes/test/myweb:v0.3-5
The push refers to repository [registry.kubernetes/test/myweb]
aac16c52a6d5: Pushed
076c58d2644f: Pushed
b2cbae4b8c15: Pushed
5ac9a5170bf2: Pushed
a464c54f93a9: Pushed
v0.3-5: digest: sha256:2ec492300be9fe3e79bf7992fcf8e643bd72fe5e64c63091f86dc3a50991fe9c size: 1360

下载镜像测试

注意: 默认情况下,docker使用的是https方式上传和下载,本次是用的是80端口,所以需要手动配置一下

[root@node03 ~]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://0tb09e4d.mirror.aliyuncs.com"], # 镜像加速
"insecure-registries": ["registry.kubernetes"] # 这里列表中可配置多个
}

说明:上述中的registry.kubernetes手动写了hosts文件,所以需要注意,在需要使用该registry的机器上,都需要能解析。

[root@node03 ~]# grep registry /etc/hosts
192.168.1.120 registry registry.kubernetes
[root@node03 ~]# docker image pull registry.kubernetes/test/myweb:v0.3-5
v0.3-5: Pulling from test/myweb
bdf0201b3a05: Pull complete
3d0a573c81ed: Pull complete
8129faeb2eb6: Pull complete
3dc99f571daf: Pull complete
f17647d105d9: Pull complete
Digest: sha256:2ec492300be9fe3e79bf7992fcf8e643bd72fe5e64c63091f86dc3a50991fe9c
Status: Downloaded newer image for registry.kubernetes/test/myweb:v0.3-5
registry.kubernetes/test/myweb:v0.3-5

Docker harbor 安装和基础操作的更多相关文章

  1. docker的安装及基础操作与镜像构建

    仓库配置及安装启动 [root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2 [root@loca ...

  2. mysql二进制安装及基础操作

    mysql二进制安装及基础操作 环境说明: 系统版本    CentOS 6.9 x86_64 软件版本    mysql-5.6.36-linux-glibc2.5-x86_64 1.安装 采用二进 ...

  3. 项目实战12.1—企业级监控工具应用实战-zabbix安装与基础操作

    无监控,不运维.好了,废话不多说,下面都是干货. 警告:流量党勿入,图片太多!!! 项目实战系列,总架构图 http://www.cnblogs.com/along21/p/8000812.html ...

  4. Kafka 教程(二)-安装与基础操作

    单机安装 1. 安装 java 2. 安装 zookeeper [这一步可以没有,因为 kafka 自带了 zookeeper] 3. 安装 kafka 下载链接 kafka kafka 是 scal ...

  5. docker安装和基础操作

    docker安装 yum install docker 配置镜像下载加速器 curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh ...

  6. Linux ubuntu下docker容器安装和基础命令

    Docker介绍: 云计算就好比大货轮,docker就是集装箱虚拟机虽然可以隔离出很多"子电脑",但占用空间更大,启动更慢,虚拟机软件可能还要花钱(例如VMWare). 而容器技术 ...

  7. docker harbor 安装 使用总结

    总结:没有验证,但是猜测. 我这个harbor的机器上  有起了一个 docker的 registry, 5000端口的,不知道是不是二者冲突. 猜测是这个情况. 1. 安装参考 收藏的链接 1.1  ...

  8. docker入门——安装及简单操作

    和安装其他软件一样,安装Docker也需要一些基本的前提条件.Docker要求的条件具体如下: 运行64位CPU构架的计算机(目前只能是x86_64和amd64),Docker目前不支持32位CPU. ...

  9. docker harbor安装

    # 官网下载离线包,https://github.com/goharbor/harbor/releases src]# tar xf harbor-offline-installer-v1.8.3.t ...

随机推荐

  1. 解决移动端touch事件与click冲突的问题

    最简单的办法,就只绑定一个事件不就行了: 第二种,我觉得和第一种也没啥区别.. const Button = document.getElementById("targetButton&qu ...

  2. MIT线性代数:2.消元法

  3. 「刷题」卡特兰数&prufer序列

    1.网格 转换模型,翻折容斥出解. 2.有趣的数列 抽象一下模型,把奇数项当作横坐标,偶数项当作纵坐标,就是从n*n矩阵左下角走到右上角并且每一步x<=y的方案数,发现是卡特兰数,关于gcd,可 ...

  4. NOIP模拟 38

    liu_runda的题! 错过辽QAQ T1虽然没用题解的损益法,但是用高精%还能过.. 没想到敲完就过编译了,还以为要调一天呢 高精度的阴影没了- T2的思路很巧妙 首先一个区间最多有一种颜色占一半 ...

  5. VNC的安装以及使用

    VNC (Virtual Network Console)是虚拟网络控制台的缩写.它 是一款优秀的远程控制工具软件,由著名的 AT&T 的欧洲研究实验室开发的.VNC 是在基于 UNIX 和  ...

  6. day6-作业(不完整)

    # 1.用代码实现:利用下划线将列表的'每一个元素'拼接成字符串 li=['ndfj','dlfj',12434]# 注意是将元素与元素转换为字符串之间用_拼接,而不是将每个字符串进行拼接 li=[' ...

  7. SQL的四种连接(左外连接、右外连接、内连接、全连接)

    1.内联接(典型的联接运算,使用像 =  或 <> 之类的比较运算符).包括相等联接和自然联接.     内联接使用比较运算符根据每个表共有的列的值匹配两个表中的行.例如,检索 stude ...

  8. nyoj 833-取石子(七) (摆成一圈,取相邻)

    833-取石子(七) 内存限制:64MB 时间限制:1000ms 特判: No 通过数:16 提交数:32 难度:1 题目描述: Yougth和Hrdv玩一个游戏,拿出n个石子摆成一圈,Yougth和 ...

  9. 力扣(LeetCode)长按键入 个人题解

    你的朋友正在使用键盘输入他的名字 name.偶尔,在键入字符 c 时,按键可能会被长按,而字符可能被输入 1 次或多次. 你将会检查键盘输入的字符 typed.如果它对应的可能是你的朋友的名字(其中一 ...

  10. centos下安装composer

    centos下,yum 安装没效果,按照官网的安装方法: curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/ ...