k8s-镜像仓库Harbor

1.前置依赖

需要:DockerCompose

2.安装

a.在线安装

### 下载安装文件

```shell
wget "https://github.com/goharbor/harbor/releases/download/v2.6.0/harbor-offline-installer-v2.6.0.tgz"

```
### 解压文件


```shell
tar -xvf harbor-offline-installer-v2.6.0.tgz
```
### 配置harbor.yml


```bash
# 设置对外访问的域名
hostname: dockerhub.ai.local
# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 88
# https related config
#https:
  # https port for harbor, default is 443
 # port: 443
  # The path of cert and key files for nginx
  #certificate: /your/certificate/path
  #private_key: /your/private/key/path
harbor_admin_password: Harbor12345
# Harbor DB configuration
database:
  # The password for the root user of Harbor DB. Change this before any production use.
  password: root123
  # The maximum number of connections in the idle connection pool. If it <=0, no idle connections are retained.
  max_idle_conns: 50
  # The maximum number of open connections to the database. If it <= 0, then there is no limit on the number of open connections.
  # Note: the default number of connections is 1024 for postgres of harbor.
  max_open_conns: 1000
# The default data volume,⚠️需要修改,设置数据的存储目录
data_volume: /export/harbor/data
......
    # The directory on your host that store log ,⚠️需要修改,设置日志的存储目录
    location: /export/harbor/log
```
### 安装harbor


```bash
./install.sh 
```
### 查看harbor安装情况



```shell
docker-compose ps
```

b.离线安装

待补充

3.停止服务

```shell
docker-compose down
```

4.常用配置

修改配置:harbor.yml

使配置生效

```shell 
# 停止服务
docker-compose down 
# 再次启动服务使配置生效
./install.sh  
```

5.配置对外访问[非必须]

使用Nginx作为访问出口,配置如下

dockerhub-harbor.conf

```shell 
upstream dockerhub-service {
    server xx.xx.xx.xx:88; 
}

server {
    listen 80;
    listen 443 ssl ; # 不可少,docker默认走这个端口,没有此配置会匹配到其他server
    server_name dockerhub.ai.local;
    
    location / {
        #需要代理的地址
        proxy_pass http://dockerhub-service;
        
    }

    access_log /usr/local/nginx/logs/dockerhub-access.log;
    error_log  /usr/local/nginx/logs/dockerhub-error.log;
}
```

6.登陆

登陆地址:http://dockerhub.ai.local/

登陆账号:admin / Harbor12345

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值