史上最全的整合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.10container_name: redis02ports:- "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: mysql02image: mysql:8.0.30ports:- "3307:3306"volumes:- mysql_data:/var/lib/mysql- mysql_conf:/etc/mysqlprivileged: trueenvironment:- "MYSQL_ROOT_PASSWORD=1234"redis:image: redis:7.0.10container_name: redis02ports:- "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/certopenssl 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.csrcat > 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
EOFopenssl x509 -req -sha512 -days 3650 -extfile v3.ext -CA ca.crt -CAkey ca.key -CAcreateserial -in core.harbor.domain.csr -out core.harbor.domain.crtopenssl x509 -inform PEM -in core.harbor.domain.crt -out core.harbor.domain.certcp 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/pathharbor_admin_password: Harbor12345           //默认密码
database:password: root123max_idle_conns: 100max_open_conns: 900conn_max_lifetime: 5mconn_max_idle_time: 0
data_volume: /data			//数据库存放路径
trivy:ignore_unfixed: falseskip_update: falseoffline_scan: falsesecurity_check: vulninsecure: 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: trueage: 168hinterval: 24hdryrun: false
cache:enabled: falseexpire_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 mainrv = self.invoke(ctx)File "/usr/lib/python3.6/site-packages/click/core.py", line 1259, in invokereturn _process_result(sub_ctx.command.invoke(sub_ctx))File "/usr/lib/python3.6/site-packages/click/core.py", line 1066, in invokereturn ctx.invoke(self.callback, **ctx.params)File "/usr/lib/python3.6/site-packages/click/core.py", line 610, in invokereturn callback(*args, **kwargs)File "/usr/src/app/commands/prepare.py", line 37, in prepareconfig_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_configconfig_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 dirNote: 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 dirNote: 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

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

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Flutter 实现软鼠标

文章目录 前言一、如何实现&#xff1f;1、记录鼠标偏移2、MouseRegion获取偏移3、Transform移动图标 二、完整代码三、使用示例总结 前言 flutter在嵌入式系统中运行时&#xff0c;有可能遇到drm鼠标无法使用的情况&#xff0c;但鼠标事件却可以正常接收&#xff0c;此时如果…

用Vite基于Vue3+ts+DataV+ECharts开发数据可视化大屏,即能快速开发又能保证屏幕适配

数据可视化大屏 基于 Vue3、Typescript、DataV、ECharts5 框架的大数据可视化&#xff08;大屏展示&#xff09;开发。此项目vue3实现界面&#xff0c;采用新版动态屏幕适配方案&#xff0c;全局渲染组件封装&#xff0c;支持数据动态刷新渲染、内部DataV、ECharts图表都支持自…

SQLite扩展插件终极集合

作为一个嵌入式数据库引擎&#xff0c;SQLite 与其他数据库管理系统相比&#xff0c;缺少了一些功能。不过 SQLite 提供了一个扩展机制&#xff0c;因此我们可以在网络上找到大量的 SQLite 插件。 今天我们介绍的这个插件叫做 sqlean&#xff0c;它打包了许多流行的 SQLite 扩…

消息队列kafka中间件详解:案例解析(第10天)

系列文章目录 1- 消息队列&#xff08;熟悉&#xff09;2- Kafka的基本介绍&#xff08;掌握架构&#xff0c;其他了解&#xff09;3- Kafka的相关使用&#xff08;掌握kafka常用shell命令&#xff09;4- Kafka的Python API的操作&#xff08;熟悉&#xff09; 文章目录 系列文…

kafka的基本模型

kafka官网 线程和线程之间的数据交互 在jvm里不同的线程有自己的栈内存&#xff0c;但彼此之间交互可以在共享的内存中进行&#xff0c;即堆内存&#xff0c;堆内存会将这些消息放到队列中&#xff0c;具体实现jvm见&#xff0c;栈内存各自维护&#xff0c;堆内存大家共享 进…

微信小程序UI组件库合集

文章目录 前言参考地址推荐组件库1.官方WeUI&#xff08;建议使用☆☆☆☆&#xff09;2.ColorUI&#xff08;广告很多&#xff0c;不建议使用&#xff09;3.vantUI又名&#xff1a;ZanUI&#xff08;操作简单&#xff0c;建议使用☆☆☆☆&#xff09;4.MinUI&#xff08;比较…

STM32---SPI通信协议(小白入、含源码)

写在前面&#xff1a;在单片机的学习过程中&#xff0c;各种通信协议的学习是必不可少的&#xff0c;在前面我们学习了串口通信、IIC通信&#xff0c;本节我们来认识一下SPI通信协议。包括其SPI基本概念、NORFLASH芯片的介绍以及相关的例程实验。 目录 一、SPI介绍 1.1什么是…

【小白专用24.6.18】C# SqlSugar:连接数据库实现简单的,增、删、改、查

【小白专用 已验证24.6.18】C# SqlSugar操作MySQL数据库实现增删改查-CSDN博客 通过NuGet包管理器搜索SqlSugar&#xff08;MySql还要安装MySql.Data、Newtonsoft.Json&#xff09;包并安装 SqlSugarClient db new SqlSugarClient(new ConnectionConfig(){ConnectionString …

中国信通院专访镜舟科技:开源商业化走了多远?

据《2023 中国开源发展蓝皮书》显示&#xff0c;随着数字化转型的深入&#xff0c;开源生态在去年快速发展&#xff0c;开源商业化的模式也逐渐成型。镜舟科技作为开源商业化的先行者&#xff0c;也在技术创新和商业拓展中稳步增长。 日前&#xff0c;中国信息通信研究院&…

Python基础教程(二十八):pip模块

&#x1f49d;&#x1f49d;&#x1f49d;首先&#xff0c;欢迎各位来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里不仅可以有所收获&#xff0c;同时也能感受到一份轻松欢乐的氛围&#xff0c;祝你生活愉快&#xff01; &#x1f49d;&#x1f49…

NGINX_十二 nginx 地址重写 rewrite

十二 nginx 地址重写 rewrite 1 什么是Rewrite Rewrite对称URL Rewrite&#xff0c;即URL重写&#xff0c;就是把传入Web的请求重定向到其他URL的过程。URL Rewrite最常见的应用是URL伪静态化&#xff0c;是将动态页面显示为静态页面方式的一种技术。比如 http://www.123.com…

2024097期传足14场胜负前瞻

2024097期售止时间为6月22日&#xff08;周六&#xff09;20点30分&#xff0c;敬请留意&#xff1a; 本期14场由欧洲杯、美洲杯、美职联组成&#xff0c;1.5以下赔率2场&#xff0c;1.5-2.0赔率10场&#xff0c;其他场次是平半盘、平盘。本期14场难度中等。以下为基础盘前瞻&a…

docker将容器打包提交为镜像,再打包成tar包

将容器打包成镜像可以通过以下步骤来实现。这里以 Docker 为例&#xff0c;假设你已经安装了 Docker 并且有一个正在运行的容器。 1. 找到正在运行的容器 首先&#xff0c;你需要找到你想要打包成镜像的容器的 ID 或者名字。可以使用以下命令查看所有正在运行的容器&#xff…

【0-1系列】从0-1快速了解搜索引擎是什么以及怎么用(上)

友情链接 社区开发版安装部署与使用教程社区版家族V2024.5版本更新说明 START>>1.快速了解搜索引擎 什么是搜索引擎数据库 搜索引擎数据库是一类专门用于数据内容搜索的NoSQL数据库&#xff0c;是非结构化大数据处理分析领域中重要的基础支撑软件。 伴随互联网、移动…

DSP应用市场的大蛋糕,国产厂商能吃下多少?

DSP是数字信号处理器&#xff08;Digital Signal Processor&#xff09;的简称&#xff0c;是一种专门用于高速数学运算的微处理器。DSP能够快速且准确地处理数字信号&#xff0c;同时具备可编程和低功耗等特点&#xff0c;如今在各个领域发挥着越来越重要的作用。 &#xff08…

【目标检测】图解 DETR 系统框图

简略版本 Backbone&#xff1a;CNN backbone 学习图像的 2D 特征Positional Encoding&#xff1a;将 2D 特征展平&#xff0c;并对其使用位置编码&#xff08;positional encoding&#xff09;Encoder&#xff1a;经过 Transformer 的 encoderDecoder&#xff1a;encoder 的输出…

spring-gateway配置说明

在开发过程中遇到的一些配置问题&#xff0c;记录下来以供参考 spring-gateway版本是2.2.9-release,使用的spring cloud dependence 是 Hoxton.SR12 在依赖eureka 服务发现并自动将发现服务器加入到router中的时候&#xff0c;需要指定对应的服务进行添加&#xff0c;根据文档…

技术分享 | 基于 API 解析的 Python 爬虫

最近各大高校纷纷翻拍 Coincidence 抖肩舞&#xff0c;需要对这种流行现象进行数据分析。数据分析首先需要有数据&#xff0c;本文介绍了爬取 B 站相应视频的评论、弹幕、播放量、点赞数等数据的方法。爬虫有多种实现方法&#xff0c;大型的网络爬虫多基于成熟的爬虫框架&#…

vue 登录

1.创建项目 Set-ExecutionPolicy RemoteSigned npm install -g yarn yarn add axios yarn add element-pluspackage.json {"name": "tom6","version": "0.1.0","private": true,"scripts": {"serve": &…

域内攻击手法——域内用户枚举和密码喷洒

一、域内用户枚举 1、域内用户枚举原理 域内用户枚举可以在无域内有效凭据的情况下&#xff0c;枚举出域内存在的用户名&#xff0c;并对其进行密码喷洒攻击&#xff0c;以此获得域内的有效凭据&#xff0c;在 Kerberos 协议认证的 AS-REQ 阶段&#xff0c;客户端向 AS 发送的…