Windows10,wsl,ubuntu20
参考:https://goharbor.io/docs/2.4.0/install-config 官网安装

1 安装(放弃)

1.1 下载 harbor 安装包

地址:https://github.com/goharbor/harbor/releases 选择对应的版本,本次选的是 harbor-offline-installer-v2.4.2.tgz

1.2 解压

tar -zxvf /mnt/d/downloads/harbor-offline-installer-v2.4.2.tgz

  1. xiaohui@220200700182:/mnt/c/Users/DELL$ tar -zxvf /mnt/d/downloads/harbor-offline-installer-v2.4.2.tgz
  2. harbor/harbor.v2.4.2.tar.gz
  3. harbor/prepare
  4. harbor/LICENSE
  5. harbor/install.sh
  6. harbor/common.sh
  7. harbor/harbor.yml.tmpl

1.3 文件结构

  1. xiaohui@220200700182:/mnt/c/Users/DELL$ cd harbor/
  2. xiaohui@220200700182:/mnt/c/Users/DELL/harbor$ pwd
  3. /mnt/c/Users/DELL/harbor
  4. xiaohui@220200700182:/mnt/c/Users/DELL/harbor$ ll -h
  5. total 601M
  6. drwxrwxrwx 1 xiaohui xiaohui 4.0K Mar 24 10:36 ./
  7. drwxrwxrwx 1 xiaohui xiaohui 4.0K Mar 24 10:36 ../
  8. -rwxrwxrwx 1 xiaohui xiaohui 12K Mar 15 11:48 LICENSE*
  9. -rwxrwxrwx 1 xiaohui xiaohui 3.3K Mar 15 11:48 common.sh*
  10. -rwxrwxrwx 1 xiaohui xiaohui 601M Mar 15 11:49 harbor.v2.4.2.tar.gz*
  11. -rwxrwxrwx 1 xiaohui xiaohui 9.5K Mar 15 11:48 harbor.yml.tmpl*
  12. -rwxrwxrwx 1 xiaohui xiaohui 2.5K Mar 15 11:48 install.sh*
  13. -rwxrwxrwx 1 xiaohui xiaohui 1.9K Mar 15 11:48 prepare*
  14. xiaohui@220200700182:/mnt/c/Users/DELL/harbor$

1.4 OpenSSL 生成证书

1.5 修改配置 harbor.yml

  1. xiaohui@220200700182:/mnt/c/Users/DELL/harbor$ cp harbor.yml.tmpl harbor.yml
  2. xiaohui@220200700182:/mnt/c/Users/DELL/harbor$
  3. xiaohui@220200700182:/mnt/c/Users/DELL/harbor$ vim harbor.yml
  4. xiaohui@220200700182:/mnt/c/Users/DELL/harbor$

创建harbor的挂载目录:

  1. xiaohui@220200700182:/mnt/c/Users/DELL$ mkdir -p /mnt/f/harbor
  2. xiaohui@220200700182:/mnt/c/Users/DELL$

harbor 主要修改的内容:

# 设置访问地址,可以使用ip、域名,不可以设置为127.0.0.1或localhost。默认情况下,harbor使用的端口是80,若使用自定义的端口,除了要改docker-compose.yml文件中的配置外,这里的hostname也要加上自定义的端口,否则在docker login、push时会报错 ostname: 192.168.0.187:9999 #http配置 http: # port for http, default is 80. If https enabled, this port will redirect to https port port: 9999 #https配置(如不需要可不配置,注释掉) # 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 # 如果要启用外部代理,比如外层的NGINX、LB等,请取消注释external_url,当它启用时,hostname将不再使用。 #external_url: https://reg.mydomain.com:8433 #admin密码 harbor_admin_password: Harbor12345 #数据库配置 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 100 for postgres. max_open_conns: 100 #持久化数据目录 data_volume: /opt/application/harbor ……

1.5 安装

命令:./install.sh

执行报错:

Traceback (most recent call last): File "docker-compose", line 3, in File "compose/cli/main.py", line 81, in main File "compose/cli/main.py", line 199, in perform_command File "compose/cli/command.py", line 70, in project_from_options File "compose/cli/command.py", line 146, in get_project File "compose/cli/command.py", line 206, in get_project_name File "posixpath.py", line 383, in abspath FileNotFoundError: [Errno 2] No such file or directory [3147] Failed to execute script docker-compose [Step 5]: starting Harbor ... Traceback (most recent call last): File "docker-compose", line 3, in File "compose/cli/main.py", line 81, in main File "compose/cli/main.py", line 199, in perform_command File "compose/cli/command.py", line 70, in project_from_options File "compose/cli/command.py", line 146, in get_project File "compose/cli/command.py", line 206, in get_project_name File "posixpath.py", line 383, in abspath FileNotFoundError: [Errno 2] No such file or directory [3149] Failed to execute script docker-compose

总是报错,wsl 下别人都可以,我的不行。。。