史上最全的整合Harbor安装教程,哈哈哈哈

一、安装docker

下载地址:https://download.docker.com/linux/static/stable/x86_64/docker-23.0.4.tgz

1.1 解压二进制包

wget https://download.docker.com/linux/static/stable/x86_64/docker-23.0.4.tgz
tar zxvf docker-23.0.4.tgz
mv docker/* /usr/bin

1.2 systemd管理docker

cat > /usr/lib/systemd/system/docker.service << EOF
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd -H --insecure-registry 192.168.8.111
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
EOF

1.3 创建配置文件

mkdir /etc/docker
cat > /etc/docker/daemon.json <<'EOF' 
{
    "registry-mirrors": [
        "https://jkfdsf2u.mirror.aliyuncs.com",
        "https://registry.docker-cn.com",
        "https://docker.mirrors.ustc.edu.cn",
        "https://dockerhub.azk8s.cn",
        "http://hub-mirror.c.163.com"
    ],
    "insecure-registries":["core.harbor.domain:32388"],
    "max-concurrent-downloads": 10,
    "max-concurrent-uploads": 5,
    "log-driver": "json-file",
    "log-opts": {
       "max-size": "300m",
       "max-file": "2"
    },
    "live-restore": true
}
EOF


# docker优化
# registry-mirrors  自定义的镜像地址
# 修改docker Cgroup Driver 为systemtd启动管理,是k8s需要,默认是cgroupfs
# max-concurrent-downloads: 最大并发下载
# max-concurrent-uploads: 最大并发上传
# log-driver: 日志格式化为 JSON。这是 Docker 默认的日志驱动程序。
# log-opts: 日志设置,单文件最大,最大几个文件
# 容器的日志都在 /var/lib/docker/containers/容器名/xxx.log
# live-restore: 在docker守护进程不可用时使容器保持活动状态

registry-mirrors: 阿里云镜像加速器
insecure-registries: 本机ip地址,不加docker login时会拒绝连接

1.4 启动并设置开机启动

systemctl daemon-reload
systemctl restart docker
systemctl enable docker
systemctl status docker

二、docker-compose安装

Docker Compose 是用来做Docker 的多容器控制,有了 Docker Compose 你可以把所有繁复的 Docker 操作全都一条命令,自动化的完成。

官网地址:https://docs.docker.com/compose/install/linux/

下载与安装:

  • 在安装docker时候已经完成了安装,直接查看版本号,查看是否安装成功

# 安装步骤 略 ....
yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# 查看docker compose的版本
docker compose version
  • 或者单独安装

# 创建指定目录存储docker compose
mkdir -p /usr/local/lib/docker/cli-plugins

# 下载并移动
curl -SL https://github.com/docker/compose/releases/download/v2.14.2/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose

# 给docker-compose文件赋予可执行权限
sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose

# 查看docker compose的版本
docker compose version

入门案例

需求:使用docker compose部署redis

  • docker-compose.yml文件的内容如下所示:

services:
  redis:
    image: redis:7.0.10
    container_name: redis02
    ports:
      - "6389:6379"
    volumes:
      - redis-data:/data
volumes:
  redis-data: {}

docker compose相关命令:

# 启动容器(如果不存在容器就创建、存在则修改)
docker compose -f docker-compose.yml up -d

# 删除所有容器
docker compose -f docker-compose.yml down

# 停止所有容器
docker compose -f docker-compose.yml stop

# 启动所有容器
docker compose -f docker-compose.yml start

# 重启所有容器
docker compose -f docker-compose.yml restart

docker compose文件中其他的常见指令参考官方文档:https://docs.docker.com/compose/compose-file/05-services/

  • 多容器配置文件示例:

services:
  mysql:
    container_name: mysql02
    image: mysql:8.0.30
    ports:
      - "3307:3306"
    volumes:
      - mysql_data:/var/lib/mysql
      - mysql_conf:/etc/mysql
    privileged: true
    environment:
      - "MYSQL_ROOT_PASSWORD=1234"
  redis:
    image: redis:7.0.10
    container_name: redis02
    ports:
      - "6389:6379"
    volumes:
      - redis-data:/data
volumes:
  mysql_data: {}
  mysql_conf: {}
  redis-data: {}

三、Harbor安装

下载地址:

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

3.1 生成证书(可以不配置)

1.添加hosts

wget https://github.com/goharbor/harbor/releases/download/v2.8.0/harbor-offline-installer-v2.8.0.tgz
echo "192.168.8.111 core.harbor.domain" >> /etc/hosts
cat /etc/hosts

2.生成证书

#!/bin/bash
 
# 生成证书的路径
mkdir -p /data/cert
cd /data/cert
 
openssl genrsa -out ca.key 4096
openssl req -x509 -new -nodes -sha512 -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=example/OU=Personal/CN=harbor19" -key ca.key -out ca.crt
openssl genrsa -out core.harbor.domain.key 4096
openssl req -sha512 -new -subj "/C=CN/ST=Beijing/L=Beijing/O=example/OU=Personal/CN=harbor19" -key core.harbor.domain.key -out core.harbor.domain.csr
 
cat > v3.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1=harbor19
DNS.2=harbor
DNS.3=ks-allinone
EOF
 
openssl x509 -req -sha512 -days 3650 -extfile v3.ext -CA ca.crt -CAkey ca.key -CAcreateserial -in core.harbor.domain.csr -out core.harbor.domain.crt
 
openssl x509 -inform PEM -in core.harbor.domain.crt -out core.harbor.domain.cert
 
cp core.harbor.domain.crt /etc/pki/ca-trust/source/anchors/core.harbor.domain.crt 
update-ca-trust

查看生成文件

[root@host cert]# ls /data/cert/
ca.crt  ca.key  ca.srl  core.harbor.domain.cert  core.harbor.domain.crt  core.harbor.domain.csr  core.harbor.domain.key  v3.ext

3.把这三个复制到docke下

mkdir -p /etc/docker/certs.d/core.harbor.domain/
cp /data/cert/core.harbor.domain.cert /etc/docker/certs.d/core.harbor.domain/
cp /data/cert/core.harbor.domain.key /etc/docker/certs.d/core.harbor.domain/
cp /data/cert/ca.crt /etc/docker/certs.d/core.harbor.domain/

3.2 安装

1.解压

[root@localhost ~]# tar -zxvf harbor-offline-installer-v2.8.0.tgz -C /usr/local/
harbor/harbor.v2.8.0.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/common.sh
harbor/harbor.yml.tmpl

2.修改配置

[root@localhost ~]# cd /usr/local/harbor/
[root@localhost /usr/local/harbor]# ls /usr/local/harbor/
common.sh             harbor.yml.tmpl  LICENSE
harbor.v2.8.0.tar.gz  install.sh       prepare
[root@localhost /usr/local/harbor]# cp harbor.yml.tmpl harbor.yml 		//配置模板信息
[root@localhost /usr/local/harbor]# cat harbor.yml.tmpl | grep -v '#' | grep -v '^$' > harbor.yml
[root@localhost /usr/local/harbor]# vim harbor.yml 
hostname: core.harbor.domain	 //修改为当前的主机ip 
http:
  port: 32388					 //修改为当前的主机端口
# https related config			//https通讯协议,不考虑对外进行关闭
# 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           //默认密码
database:
  password: root123
  max_idle_conns: 100
  max_open_conns: 900
  conn_max_lifetime: 5m
  conn_max_idle_time: 0
data_volume: /data			//数据库存放路径
trivy:
  ignore_unfixed: false
  skip_update: false
  offline_scan: false
  security_check: vuln
  insecure: false
jobservice:
  max_job_workers: 10
notification:
  webhook_job_max_retry: 3
log:									//日志容器
  level: info                     //为最低级别的日志
  local:
    rotate_count: 50                 //最多滚动50个日志
    rotate_size: 200M                //每次滚动超过200M后将重新生成
    location: /var/log/harbor		       //日志的存放目录
_version: 2.8.0
proxy:
  http_proxy:
  https_proxy:
  no_proxy:
  components:
    - core
    - jobservice
    - trivy
upload_purging:
  enabled: true
  age: 168h
  interval: 24h
  dryrun: false
cache:
  enabled: false
  expire_hours: 24

3. 安装

注意:如果安装的时候报错了,可以给docker配置多个镜像地址:

// 编辑文件
vim /etc/docker/daemon.json

// 文件内容
{
  "registry-mirrors": ["https://registry.docker-cn.com","http://hub-mirror.c.163.com","http://f1361db2.m.daocloud.io","https://mirror.ccs.tencentyun.com","https://phtv51hj.mirror.aliyuncs.com"]
}

启动关闭命令

docker compose -f docker-compose.yml up -d            启动 Harbor
docker compose -f docker-compose.yml stop             关闭 Harbor

安装一切顺利的话,Harbor has been installed and started successfully.如图:

会遇到的几个问题如下:

上文已经把harbor下载好,接下来需要修改配置文件,我便自己填写了一个yml的配置文件,发现报错了,如下:报错一
## 注意此步是自己编写的yml文件,但是会出现下面的报错信息,提示data_volume找不到
[root@linux-001 harbor]# cat harbor.yml
hostname: harbor.ideacome.com
certificate: /opt/harbor/ideacome.crt
private_key: /opt/harbor/ideacome.key
harbor_admin_password: harbor-12345

[root@linux-003 harbor]# sh install.sh

[Step 0]: checking if docker is installed ...

Note: docker version: 20.10.4

[Step 1]: checking docker-compose is installed ...

Note: docker-compose version: 1.28.5

[Step 2]: loading Harbor images ...
07ed3fe22282: Loading layer [==================================================>]  34.51MB/34.51MB
632651017131: Loading layer [==================================================>]  8.071MB/8.071MB
cff019bd8e54: Loading layer [==================================================>]  3.584kB/3.584kB
db8113c9a129: Loading layer [==================================================>]   2.56kB/2.56kB
04eaffb344c9: Loading layer [==================================================>]  61.03MB/61.03MB
30932a235d0d: Loading layer [==================================================>]  61.85MB/61.85MB
Loaded image: goharbor/harbor-jobservice:v2.2.0
68170e81b04b: Loading layer [==================================================>]  34.51MB/34.51MB
c0276ff1011e: Loading layer [==================================================>]  7.815MB/7.815MB
892518eb7e09: Loading layer [==================================================>]  17.61MB/17.61MB
25f373af3c04: Loading layer [==================================================>]  4.608kB/4.608kB
df5c0f8011ee: Loading layer [==================================================>]  18.43MB/18.43MB
Loaded image: goharbor/harbor-exporter:v2.2.0
d6b0c623c73b: Loading layer [==================================================>]  4.933MB/4.933MB
494ceea2a6b4: Loading layer [==================================================>]  4.096kB/4.096kB
64e95a63b7a3: Loading layer [==================================================>]  3.072kB/3.072kB
f2c35b3b0dcd: Loading layer [==================================================>]  18.99MB/18.99MB
5c74d99fc846: Loading layer [==================================================>]  19.81MB/19.81MB
Loaded image: goharbor/registry-photon:v2.2.0
3fbc0344880d: Loading layer [==================================================>]  8.072MB/8.072MB
9c5adc52de0d: Loading layer [==================================================>]  3.584kB/3.584kB
05781011aa08: Loading layer [==================================================>]   2.56kB/2.56kB
19e4b43530bc: Loading layer [==================================================>]  53.27MB/53.27MB
9a88bba5ca8d: Loading layer [==================================================>]  5.632kB/5.632kB
7c2bf6707239: Loading layer [==================================================>]  87.55kB/87.55kB
b1aeff496e1d: Loading layer [==================================================>]  11.78kB/11.78kB
f8d3079c10d4: Loading layer [==================================================>]   54.2MB/54.2MB
eb473baf6abd: Loading layer [==================================================>]   2.56kB/2.56kB
Loaded image: goharbor/harbor-core:v2.2.0
f649b07d9770: Loading layer [==================================================>]  63.77MB/63.77MB
a1252bd74521: Loading layer [==================================================>]     80MB/80MB
12a45cabca01: Loading layer [==================================================>]  6.144kB/6.144kB
cb64020cac49: Loading layer [==================================================>]   2.56kB/2.56kB
11273c337dac: Loading layer [==================================================>]   2.56kB/2.56kB
06bf2b44257c: Loading layer [==================================================>]   2.56kB/2.56kB
ae1d550e31f7: Loading layer [==================================================>]   2.56kB/2.56kB
5418b645d05a: Loading layer [==================================================>]  11.26kB/11.26kB
Loaded image: goharbor/harbor-db:v2.2.0
165bc38d4a20: Loading layer [==================================================>]  4.926MB/4.926MB
4450dd70e473: Loading layer [==================================================>]  5.926MB/5.926MB
571aff5ac473: Loading layer [==================================================>]  14.86MB/14.86MB
7213db5cd3f6: Loading layer [==================================================>]  27.36MB/27.36MB
feb90353404b: Loading layer [==================================================>]  22.02kB/22.02kB
2bf612d23dd5: Loading layer [==================================================>]  14.86MB/14.86MB
Loaded image: goharbor/notary-server-photon:v2.2.0
75b7bc9e1233: Loading layer [==================================================>]  6.237MB/6.237MB
45cc62077a3e: Loading layer [==================================================>]  4.096kB/4.096kB
0254af6d0275: Loading layer [==================================================>]  3.072kB/3.072kB
6b42f8a7f98d: Loading layer [==================================================>]   28.3MB/28.3MB
4c3750e9c704: Loading layer [==================================================>]  11.38MB/11.38MB
2f3db0c6619f: Loading layer [==================================================>]   40.5MB/40.5MB
Loaded image: goharbor/trivy-adapter-photon:v2.2.0
bbd0a1895331: Loading layer [==================================================>]  4.933MB/4.933MB
5db7b6078317: Loading layer [==================================================>]  4.096kB/4.096kB
b2a993735d1e: Loading layer [==================================================>]  18.99MB/18.99MB
46f8d3251467: Loading layer [==================================================>]  3.072kB/3.072kB
36435ed81d46: Loading layer [==================================================>]  25.32MB/25.32MB
586ede682f3f: Loading layer [==================================================>]  45.14MB/45.14MB
Loaded image: goharbor/harbor-registryctl:v2.2.0
59cead1174d4: Loading layer [==================================================>]  35.94MB/35.94MB
8c26e21f2027: Loading layer [==================================================>]  3.072kB/3.072kB
741a65c6dac7: Loading layer [==================================================>]   59.9kB/59.9kB
438633fad008: Loading layer [==================================================>]  61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v2.2.0
2fc5cd36d28c: Loading layer [==================================================>]  76.07MB/76.07MB
6a135eaee93d: Loading layer [==================================================>]  3.584kB/3.584kB
e5c3feb6aca0: Loading layer [==================================================>]  3.072kB/3.072kB
a31d1977777a: Loading layer [==================================================>]   2.56kB/2.56kB
0969721e9ff9: Loading layer [==================================================>]  3.072kB/3.072kB
e790c9ba4ed2: Loading layer [==================================================>]  3.584kB/3.584kB
ee43eb3a3893: Loading layer [==================================================>]  12.29kB/12.29kB
Loaded image: goharbor/harbor-log:v2.2.0
45a339152b94: Loading layer [==================================================>]  6.779MB/6.779MB
Loaded image: goharbor/nginx-photon:v2.2.0
e6c87254655c: Loading layer [==================================================>]  4.926MB/4.926MB
385174b02cde: Loading layer [==================================================>]  5.926MB/5.926MB
427415aeb0cc: Loading layer [==================================================>]  13.33MB/13.33MB
a46c9a86420a: Loading layer [==================================================>]  27.36MB/27.36MB
0646903e30c4: Loading layer [==================================================>]  22.02kB/22.02kB
74c332a73d82: Loading layer [==================================================>]  13.33MB/13.33MB
Loaded image: goharbor/notary-signer-photon:v2.2.0
d6c1f4fe3f89: Loading layer [==================================================>]  4.932MB/4.932MB
da140a6b9c66: Loading layer [==================================================>]  62.71MB/62.71MB
014c145ecf1c: Loading layer [==================================================>]  3.072kB/3.072kB
73ad0cb1c27d: Loading layer [==================================================>]  4.096kB/4.096kB
4d442ea85017: Loading layer [==================================================>]  63.53MB/63.53MB
Loaded image: goharbor/chartmuseum-photon:v2.2.0
c8fae5121874: Loading layer [==================================================>]  77.48MB/77.48MB
3b920f9fa989: Loading layer [==================================================>]  54.62MB/54.62MB
f156b6b2a217: Loading layer [==================================================>]   2.56kB/2.56kB
906ca23bc04b: Loading layer [==================================================>]  1.536kB/1.536kB
12b8ebf41897: Loading layer [==================================================>]  18.43kB/18.43kB
6190944c245c: Loading layer [==================================================>]  4.058MB/4.058MB
e08cb3f4e745: Loading layer [==================================================>]  278.5kB/278.5kB
Loaded image: goharbor/prepare:v2.2.0
366e44984cdc: Loading layer [==================================================>]  6.779MB/6.779MB
eb1850e4d6ec: Loading layer [==================================================>]  9.096MB/9.096MB
ecaa0fbfe5ea: Loading layer [==================================================>]  1.691MB/1.691MB
Loaded image: goharbor/harbor-portal:v2.2.0


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /opt/harbor
Traceback (most recent call last):
  File "main.py", line 15, in <module>
    cli()
  File "/usr/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/src/app/commands/prepare.py", line 37, in prepare
    config_dict = parse_yaml_config(conf, with_notary=with_notary, with_trivy=with_trivy, with_chartmuseum=with_chartmuseum)
  File "/usr/src/app/utils/configs.py", line 168, in parse_yaml_config
    config_dict['data_volume'] = configs['data_volume']
KeyError: 'data_volume'

发现上文的报错后,发现harbor本身给提供了一个配置文件harbor.yml.tmpl,我们只需要修改此配置文件即可。

[root@linux-001 harbor]# mv harbor.yml harbor.yml.zdybak
[root@linux-001 harbor]#
[root@linux-001 harbor]# vim harbor.yml.tmpl
[root@linux-001 harbor]# cp harbor.yml.tmpl harbor.yml
[root@linux-001 harbor]# mkdir -p /data/harbor/

[root@linux-001 harbor]# sh install.sh

[Step 0]: checking if docker is installed ...

Note: docker version: 20.10.4

[Step 1]: checking docker-compose is installed ...

Note: docker-compose version: 1.28.5

[Step 2]: loading Harbor images ...
Loaded image: goharbor/harbor-jobservice:v2.2.0
Loaded image: goharbor/harbor-exporter:v2.2.0
Loaded image: goharbor/registry-photon:v2.2.0
Loaded image: goharbor/harbor-core:v2.2.0
Loaded image: goharbor/harbor-db:v2.2.0
Loaded image: goharbor/notary-server-photon:v2.2.0
Loaded image: goharbor/trivy-adapter-photon:v2.2.0
Loaded image: goharbor/harbor-registryctl:v2.2.0
Loaded image: goharbor/redis-photon:v2.2.0
Loaded image: goharbor/harbor-log:v2.2.0
Loaded image: goharbor/nginx-photon:v2.2.0
Loaded image: goharbor/notary-signer-photon:v2.2.0
Loaded image: goharbor/chartmuseum-photon:v2.2.0
Loaded image: goharbor/prepare:v2.2.0
Loaded image: goharbor/harbor-portal:v2.2.0


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /opt/harbor
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir



[Step 5]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating redis         ... done
Creating harbor-db     ... done
Creating registry      ... done
Creating harbor-portal ... done
Creating registryctl   ... done
Creating harbor-core   ... done
Creating nginx             ... done
Creating harbor-jobservice ... done
? ----Harbor has been installed and started successfully.----

报错二:如下图 redis已经存在并运行

[root@localhost harbor]# sh install.sh

[Step 0]: checking if docker is installed ...

Note: docker version: 26.1.4

[Step 1]: checking docker-compose is installed ...

Note: Docker Compose version v2.27.1

[Step 2]: loading Harbor images ...
Loaded image: goharbor/harbor-core:v2.11.0
Loaded image: goharbor/harbor-db:v2.11.0
Loaded image: goharbor/nginx-photon:v2.11.0
Loaded image: goharbor/trivy-adapter-photon:v2.11.0
Loaded image: goharbor/redis-photon:v2.11.0
Loaded image: goharbor/registry-photon:v2.11.0
Loaded image: goharbor/prepare:v2.11.0
Loaded image: goharbor/harbor-portal:v2.11.0
Loaded image: goharbor/harbor-log:v2.11.0
Loaded image: goharbor/harbor-jobservice:v2.11.0
Loaded image: goharbor/harbor-registryctl:v2.11.0
Loaded image: goharbor/harbor-exporter:v2.11.0


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /usr/local/harbor
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir


Note: stopping existing Harbor instance ...
WARN[0000] /usr/local/harbor/docker-compose.yml: `version` is obsolete 


[Step 5]: starting Harbor ...
WARN[0000] /usr/local/harbor/docker-compose.yml: `version` is obsolete 
[+] Running 2/2
 ✔ Network harbor_harbor    Created                                                                                                                                     0.1s 
 ✔ Container harbor-log     Created                                                                                                                                     0.1s 
 ⠋ Container harbor-db      Creating                                                                                                                                    0.0s 
 ⠋ Container redis          Creating                                                                                                                                    0.0s 
 ⠋ Container registry       Creating                                                                                                                                    0.0s 
 ⠋ Container registryctl    Creating                                                                                                                                    0.0s 
 ⠋ Container harbor-portal  Creating                                                                                                                                    0.0s 
Error response from daemon: Conflict. The container name "/redis" is already in use by container "7c087c034657b695b2b42b7337e6f06dcf5731613f86a57472b44884358fdab2". You have to remove (or rename) that container to be able to reuse that name.

解决如下:

[root@localhost harbor]# docker rm -f redis
redis
[root@localhost harbor]# docker ps
CONTAINER ID   IMAGE          COMMAND                   CREATED       STATUS       PORTS                                                                                  NAMES
a474c18c5463   minio/minio    "/usr/bin/docker-ent…"   4 weeks ago   Up 2 hours   0.0.0.0:9090->9090/tcp, :::9090->9090/tcp, 0.0.0.0:9001->9000/tcp, :::9001->9000/tcp   minio
91360e222bc7   mysql:8.0.30   "docker-entrypoint.s…"   8 weeks ago   Up 2 hours   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp                                   mysql

把redis删掉,从新运行即可成功:

[root@localhost harbor]# sh install.sh

[Step 0]: checking if docker is installed ...

Note: docker version: 26.1.4

[Step 1]: checking docker-compose is installed ...

Note: Docker Compose version v2.27.1

[Step 2]: loading Harbor images ...
Loaded image: goharbor/harbor-core:v2.11.0
Loaded image: goharbor/harbor-db:v2.11.0
Loaded image: goharbor/nginx-photon:v2.11.0
Loaded image: goharbor/trivy-adapter-photon:v2.11.0
Loaded image: goharbor/redis-photon:v2.11.0
Loaded image: goharbor/registry-photon:v2.11.0
Loaded image: goharbor/prepare:v2.11.0
Loaded image: goharbor/harbor-portal:v2.11.0
Loaded image: goharbor/harbor-log:v2.11.0
Loaded image: goharbor/harbor-jobservice:v2.11.0
Loaded image: goharbor/harbor-registryctl:v2.11.0
Loaded image: goharbor/harbor-exporter:v2.11.0


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /usr/local/harbor
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Clearing the configuration file: /config/portal/nginx.conf
Clearing the configuration file: /config/log/logrotate.conf
Clearing the configuration file: /config/log/rsyslog_docker.conf
Clearing the configuration file: /config/nginx/nginx.conf
Clearing the configuration file: /config/core/env
Clearing the configuration file: /config/core/app.conf
Clearing the configuration file: /config/registry/passwd
Clearing the configuration file: /config/registry/config.yml
Clearing the configuration file: /config/registryctl/env
Clearing the configuration file: /config/registryctl/config.yml
Clearing the configuration file: /config/db/env
Clearing the configuration file: /config/jobservice/env
Clearing the configuration file: /config/jobservice/config.yml
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
loaded secret from file: /data/secret/keys/secretkey
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir


Note: stopping existing Harbor instance ...
WARN[0000] /usr/local/harbor/docker-compose.yml: `version` is obsolete 
[+] Running 6/6
 ✔ Container harbor-portal  Removed                                                                                                                                     0.0s 
 ✔ Container registryctl    Removed                                                                                                                                     0.0s 
 ✔ Container harbor-db      Removed                                                                                                                                     0.0s 
 ✔ Container registry       Removed                                                                                                                                     0.0s 
 ✔ Container harbor-log     Removed                                                                                                                                     0.0s 
 ✔ Network harbor_harbor    Removed                                                                                                                                     0.1s 


[Step 5]: starting Harbor ...
WARN[0000] /usr/local/harbor/docker-compose.yml: `version` is obsolete 
[+] Running 10/10
 ✔ Network harbor_harbor        Created                                                                                                                                 0.1s 
 ✔ Container harbor-log         Started                                                                                                                                 0.5s 
 ✔ Container harbor-db          Started                                                                                                                                 1.5s 
 ✔ Container registryctl        Started                                                                                                                                 1.6s 
 ✔ Container harbor-portal      Started                                                                                                                                 1.6s 
 ✔ Container registry           Started                                                                                                                                 1.5s 
 ✔ Container redis              Started                                                                                                                                 1.6s 
 ✔ Container harbor-core        Started                                                                                                                                 2.0s 
 ✔ Container harbor-jobservice  Started                                                                                                                                 3.6s 
 ✔ Container nginx              Started                                                                                                                                 3.6s 
✔ ----Harbor has been installed and started successfully.

3.4 访问Harbor
浏览器输入ip地址,用户名默认:admin,密码是harbor.yml中配置的

  • 访问地址:http://192.168.0.117/

5、docker添加安全访问权限

# 编辑/etc/docker/daemon.json文件
vim /etc/docker/daemon.json

# 添加安全访问权限
{
  "insecure-registries":["http://192.168.0.117"]
}

# 重启Docker
systemctl restart docker

创作不易,谢谢大家。随时交流

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/730977.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【C语言】16.动态内存管理

文章目录 1.为什么要有动态内存分配2.malloc和free2.1 malloc2.2 free 3.calloc和realloc3.1 calloc3.2 realloc 4.常见的动态内存的错误4.1 对NULL指针的解引⽤操作4.2 对动态开辟空间的越界访问4.3 对⾮动态开辟内存使⽤free释放4.4 使⽤free释放⼀块动态开辟内存的⼀部分4.5…

对红酒数据集,分别采用决策树算法和随机森林算法进行分类。

1.导入所需要的包 from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.datasets import load_wine from sklearn.model_selection import train_test_split 2.导入数据&#xff0c;并且对随机森林和决策数进…

每月 GitHub 探索|10 款引领科技趋势的开源项目

1.IT-Tools 仓库名称&#xff1a; CorentinTh/it-tools 截止发稿星数: 16842 (近一个月新增:5744) 仓库语言: Vue 仓库开源协议&#xff1a; GNU General Public License v3.0 引言 CorentinTh/it-tools 是一个开源项目&#xff0c;提供各种对开发者友好的在线工具&#xff0…

教师数字素养标准

老师们有没有想过如何让自己的课堂更加生动、互动&#xff0c;甚至超越传统的教学模式&#xff1f;是否思考过&#xff0c;数字技术如何成为我们教学的得力助手&#xff0c;让我们的课堂焕发出新的活力&#xff1f; 数字素养&#xff0c;这个听起来充满科技感的词汇&#xff0c…

接口实现多态

多态&#xff1a; 父类的引用类型变量指向了子类的对象或者是接口类型的引用类型变量指向了接口实现类 的对象。 实现关系下的多态&#xff1a; 接口 变量 new 接口实现类的对象。 接口 public abstract interface InterA {public abstract void show();}实现类 public c…

文件上传漏洞-上篇

一、概述 文件上传漏洞可以说是日常渗透测试中用得最多的一个漏洞&#xff0c;用它获得服务器权限最快最直接。在web程序中&#xff0c;经常需要用到文件上传的功能。如用户或者管理员上传图片&#xff0c;或者其它文件。如果没有限制上传类型或者限制不严格被绕过&#xff0c…

数据结构6---树

一、定义 树(Tree)是n(n>0)个结点的有限集。当n0时成为空树,在任意一棵非空树中: 1、有且仅有一个特定的称为根(Root)的结点; 2、当n>1时,其余结点可分为m(m>日)个互不相交的有限集T1、T2、...、 Tm&#xff0c;其中每一个集合本身又是一棵树&#xff0c;并且称为根的…

LabVIEW项目中的常见电机及其特点分析

在LabVIEW项目中&#xff0c;电机的选择对系统的性能和应用效果至关重要。常见电机类型包括直流电机&#xff08;DC Motor&#xff09;、步进电机&#xff08;Stepper Motor&#xff09;、交流感应电机&#xff08;AC Induction Motor&#xff09;和无刷直流电机&#xff08;BL…

【MySQL进阶之路 | 高级篇】InnoDB搜索引擎行格式

1. COMPACT行格式 COMPACT行格式是MySQL5.1的默认行格式.其结构示意图如下. 大体可以分为两部分. 记录的额外信息.这里面有包括变长字段长度列表&#xff0c;NULL值列表和记录头信息.记录的真实数据. (1).变长字段长度列表 MySQL支持一些变长的数据类型.比如VARCHAR(m), VA…

【扫雷游戏】C语言实现

机器学习&#xff1a;Transformer框架理论详解和代码实现>Hi~&#xff01;这里是奋斗的小羊&#xff0c;很荣幸您能阅读我的文章&#xff0c;诚请评论指点&#xff0c;欢迎欢迎 ~~ &#x1f4a5;&#x1f4a5;个人主页&#xff1a;奋斗的小羊 &#x1f4a5;&#x1f4a5;所属…

别让破损安全鞋,成为你工作中无法预见的“隐形杀手”

在日常生活中&#xff0c;安全鞋是我们的“守护神”&#xff0c;默默守护着我们的双脚&#xff0c;抵御着来自工作环境的各种风险。然而&#xff0c;当安全鞋出现破损时&#xff0c;我们却常常视而不见&#xff0c;以为这只是微不足道的小事&#xff0c;很多人可能会选择“将就…

ASP.NET Core 6.0 使用 Log4Net 和 Nlog日志中间件

前言 两年前,浅浅的学过 .NET 6,为啥要记录下来,大概是为了以后搭架子留下引线,还有抛砖引玉。 1. 环境准备 下载 建议使用 Visual Studio 2022 开发版 官网的下载地址:Visual Studio 2022 IDE - 适用于软件开发人员的编程工具借助 Visual Studio 设计,具有自动完成…

SFF2004A-ASEMI无人机专用SFF2004A

编辑&#xff1a;ll SFF2004A-ASEMI无人机专用SFF2004A 型号&#xff1a;SFF1006A 品牌&#xff1a;ASEMI 封装&#xff1a;ITO-220AC 最大平均正向电流&#xff08;IF&#xff09;&#xff1a;20A 最大循环峰值反向电压&#xff08;VRRM&#xff09;&#xff1a;400V 最…

智能体合集

海外版coze: 前端代码助手 后端代码助手&#xff1a; 前端代码助手&#xff1a;

大数据-数据分析师利用excel绘图

你会用excel&#xff0c;统计数据吗&#xff1f;我是大数据工程师&#xff0c;但是我不会excel。那咋办&#xff1f; 用sql&#xff0c;统计&#xff0c;导出到excel&#xff0c;在用excel统计。本文主要讨论的是导出到excel后&#xff0c;画图。 图是什么&#xff1f; x和y…

【C++】数据类型、函数、头文件、断点调试、输入输出、条件与分支、VS项目设置

四、基本概念 这部分和C语言重复的部分就简写速过&#xff0c;因为我之前写过一个C语言的系列&#xff0c;非常详细。C和C这些都是一样的&#xff0c;所以这里不再一遍遍重复码字了。感兴趣的同学可以翻看我之前的C语言系列文章。 1、数据类型 编程的本质就是操作数据。 操…

山东济南比较出名的起名大师的老师,中国最厉害的改名大师颜廷利:短命的小草,年年自损;长寿的大树,万古长青。。。(升命学说)

在中国第一起名大师的老师颜廷利教授的《升命学说》中&#xff0c;通过“净化论”、“和合法则”、“唯悟主义”以及“镜正理念”的阐述&#xff0c;我们得以窥见生命的不同维度。他以自然界中短命的小草与长寿的大树为例&#xff0c;揭示了生命形态的对比与哲理。 小草&#…

“打造智能售货机系统,基于ruoyi微服务版本开源项目“

目录 # 开篇 售货机术语 1. 表设计说明 2. 页面展示 2.1 区域管理页面 2.2 合作商管理页面 2.3 点位管理页面 3. 建表资源 3.1 创建表的 SQL 语句&#xff08;包含字段备注&#xff09; 1. Region 表 2. Node 表 3. Partner 表 4. 创建 tb_vending_machine 表的 S…

2024会展行业发展趋势预测

在当今这个数字化浪潮汹涌的时代&#xff0c;会展行业也迎来了自己的变革时刻。 根据《2023中国会展主办机构数字化调研报告》&#xff0c;我们可以清晰地看到几个显著的趋势&#xff1a; 首先&#xff0c;数字化转型已经不再是一道选择题&#xff0c;而是必答题。 超过90%的…

伦敦银趋势线的有效性怎么验证?

怎么才能画出一根能发挥作用的趋势线呢&#xff1f;这是很多投资者追求的目标。其实要趋势线能发挥作用&#xff0c;我们在画它的时候就要进行一些验证&#xff0c;将通过了验证的趋势线保留下来&#xff0c;那些没通过的就删除&#xff0c;这样得到能发挥作用的趋势线的概率就…