CentOS HarBor https 自签证书安装与配置

HarBor 安装与配置

Prerequisites for the target host

Resource Capacity Description
CPU minimal 2 CPU 4 CPU is preferred
Mem minimal 4GB 8GB is preferred
Disk minimal 40GB 160GB is preferred

network port

port Protocol Description
443 HTTPS Harbor portal and core API will accept requests on this port for https protocol
4443 HTTPS Connections to the Docker Content Trust service for Harbor, only needed when Notary is enabled
80 HTTP Harbor portal and core API will accept requests on this port for http protocol

1. 安装和配置docker-compose

docker安装不予赘述
docker默认走https,需要将地址添加到/etc/docker/daemon.json(没有就创建),添加一下内容

{
    "insecure-registries": ["<YOUR HOSTNAME>:443"]
}

<>括号内填写自己的hostname,如 insecure-registries": ["oran:443"]

1.1 安装docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
如果需要用到代理,可加上-x "http://ip:port"

1.2 使二进制文件可执行

sudo chmod +x /usr/local/bin/docker-compose

1.3 检查docoker-compose版本

[admin@harbor harbor]$ docker-compose version
docker-compose version 1.23.1, build b02f1306
docker-py version: 3.5.0
CPython version: 3.6.7
OpenSSL version: OpenSSL 1.1.0f  25 May 2017

2. 安装和配置harbor

2.1 创建自签证书

openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout oran.key -out oran.crt

2.2 下载所需要的版本,离线或在线。

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

wget https://github.com/goharbor/harbor/releases/download/v1.10.4/harbor-offline-installer-v1.10.4.tgz

2.3 配置harbor

此处为简易安装配置

cd harbor
vim harbor.yml
hostname =<YOUR HOSTNAME>
https:
  # https port for harbor, default is 443
  port: 443
  # The path of cert and key files for nginx
  certificate: /home/oran.crt
  private_key: /home/oran.key

不要用localhost和127.0.0.1

2.3 默认安装

sudo ./install.sh

install.PNG

docker ps

login.PNG

harbor.PNG

2.4 测试

新建一个test的项目用于存放test镜像

test_project.PNG

测试

docker login https://oran #默认密码Harbor12345
docker pull busybox:latest # 先从网络上拉取一个busybox镜像
docker tag busybox:latest oran/test/busybox:latest #打上你所想要的tag,私有仓库路径和项目名写在镜像名前。
docker push oran/test/busybox:latest #上传成功可去harbor页面查看
docker pull oran/test/busybox:latest

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容