Harbor安装及使用指南

下面将介绍在centos7环境中harbor的安装过程及注意事项,harbor版本为v1.9.1

安装Docker

由于安装v1.9.1版本所需要的docker版本至少为17,但通过centos官方yum源安装的docker版本为13,所以需要安装更新版本的docker。

首先设置国内的yum源:

yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

然后获取docker-ce不同版本的可安装软件包列表:

yum list docker-ce --showduplicates

接下来安装指定版本的docker-ce

yum install docker-ce.18.06.3.ce-3.el7

安装docker-compose

yum install docker-compose

安装Harbor

下载安装包

首先通过官方下载地址,获取离线安装包。

通过Harbor offline installer链接进行下载,得到harbor-offline-installer-v1.9.1.tgz,并将其解压。

解压后会看到以下文件:

.
├── harbor.v1.9.1.tar.gz
├── harbor.yml
├── install.sh
├── LICENSE
└── prepare

其中harbor.v1.9.1.tar.gz即为harbor的镜像文件。

修改配置

编辑harbor.yml文件,修改ip地址和端口。

# Configuration file of Harbor
# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 192.168.3.104

# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 8888

执行安装

执行./prepare进行配置文件初始化,然后执行./install.sh安装。安装过程中需要载入harbor镜像,请耐心等待。

访问Harbor

安装完成后,根据配置文件中配置的ip和port,通过浏览器访问Harbor管理界面。初始用户名和密码为admin/Harbor12345

Harbor的启动与关闭

进入harbor安装目录,执行以下命令启动或关闭harbor。

启动

docker-compose start

关闭

docker-compose stop

问题与解决方法

问题1

ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule: (iptables failed: iptables --wait -t nat -I DOCKER -i br-c003c9610335 -j RETURN: iptables: No chain/target/match by that name.

解决方法

重启docker

systemctl restart docker

再重新执行harbor安装脚本sh install.sh

问题2

docker登录仓库失败,提示信息:

Error response from daemon: Get http://192.168.6.191:8888/v2/: dial tcp 192.168.6.191:8888: connect: connection refused

解决方法

在docker.service文件中添加--insecure-registry参数指定仓库地址和端口。

ExecStart=/usr/bin/dockerd --insecure-registry=192.168.6.191:8888

重启docker

systemctl restart docker

重新登录仓库

[root@registry systemd]# docker login 192.168.6.191:8888
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

猜你喜欢

转载自blog.csdn.net/ldjjbzh626/article/details/103175087