网站策划制作公司百度搜索指数1000是什么
有需要相关资源可以私信我
安装harbor首先要安装docker和docker-compose
docker安装可以看上篇文章
一、安装docker-compos
上传文件之后先赋予权限 然后移动目录
[root@localhost ~]# chmod +x docker-compose
[root@localhost ~]# mv docker-compose /usr/local/bin/
[root@localhost ~]# docker-compose -v
Docker Compose version v2.28.1
二、安装harbor
[root@localhost ~]# tar -xzvf harbor-offline-installer-v2.8.4.tgz
harbor/harbor.v2.8.4.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/common.sh
harbor/harbor.yml.tmpl
[root@localhost ~]# cd harbor/
[root@localhost harbor]# cp harbor.yml.tmpl harbor.yml
[root@localhost harbor]# vi harbor.yml
# Configuration file of Harbor# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 192.168.247.158# http related config
http:# port for http, default is 80. If https enabled, this port will redirect to https portport: 80# https related config
https:# https port for harbor, default is 443port: 443# The path of cert and key files for nginxcertificate: /root/harbor/certs/harbor.crtprivate_key: /root/harbor/certs/harbor.key
若要配置域名 在hostname后写入想要配置的地址即可 然后在/etc/hosts文件和windows的hosts写入即可
其中 certificate: /root/harbor/certs/harbor.crt
private_key: /root/harbor/certs/harbor.key 为稍后创建的证书目录
证书创建这里我写了一个脚本文件 直接使用创建即可
若要harbor正常使用 需要将信息写入docker文件中
[root@localhost certs]# vi /etc/docker/daemon.json{"registry-mirrors": ["https://do.nark.eu.org","https://dc.j8.work","https://pilvpemn.mirror.aliyuncs.com","https://docker.m.daocloud.io","https://dockerproxy.com","https://docker.mirrors.ustc.edu.cn","https://docker.nju.edu.cn"],"exec-opts": ["native.cgroupdriver=systemd"],"log-driver": "json-file","log-opts": {"max-size": "100m"},"storage-driver": "overlay2","insecure-registries": ["192.168.247.158"]
}
systemctl daemon-reload
将 Harbor 服务器的自签名证书(CA 证书)放置在正确的位置,以便 Docker 客户端可以找到并信任它。
[root@localhost harbor]# mkdir -p /etc/docker/certs.d/192.168.237.158/
[root@localhost harbor]# cp /root/harbor/certs/harbor.crt /etc/docker/certs.d/192.168.237.158/ca.crt
[root@localhost harbor]# systemctl restart docker
此时就可以进入harbor目录进行启动了
[root@localhost harbor]# ./install.sh
看到这样即为成功
此时打开浏览器 输入配置的ip地址
输入默认的账号密码admin/Harbor12345即可登录
此次可以docker登录harbor 上传镜像进行验证
[root@localhost harbor]# docker login 192.168.247.158
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded