网站模板购买 优帮云,全网推广怎么做,桂林优化公司,网络营销方案如何写有需要相关资源可以私信我
安装harbor首先要安装docker和docker-compose
docker安装可以看上篇文章
一、安装docker-compos
上传文件之后先赋予权限 然后移动目录
[rootlocalhost ~]# chmod x docker-compose
[rootlocalhost ~]# mv docker-compose /usr/local/bin/
[ro…有需要相关资源可以私信我
安装harbor首先要安装docker和docker-compose
docker安装可以看上篇文章
一、安装docker-compos
上传文件之后先赋予权限 然后移动目录
[rootlocalhost ~]# chmod x docker-compose
[rootlocalhost ~]# mv docker-compose /usr/local/bin/
[rootlocalhost ~]# docker-compose -v
Docker Compose version v2.28.1 二、安装harbor
[rootlocalhost ~]# 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
[rootlocalhost ~]# cd harbor/
[rootlocalhost harbor]# cp harbor.yml.tmpl harbor.yml
[rootlocalhost 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文件中
[rootlocalhost 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.cgroupdriversystemd],log-driver: json-file,log-opts: {max-size: 100m},storage-driver: overlay2,insecure-registries: [192.168.247.158]
}
systemctl daemon-reload 将 Harbor 服务器的自签名证书CA 证书放置在正确的位置以便 Docker 客户端可以找到并信任它。
[rootlocalhost harbor]# mkdir -p /etc/docker/certs.d/192.168.237.158/
[rootlocalhost harbor]# cp /root/harbor/certs/harbor.crt /etc/docker/certs.d/192.168.237.158/ca.crt
[rootlocalhost harbor]# systemctl restart docker此时就可以进入harbor目录进行启动了
[rootlocalhost harbor]# ./install.sh 看到这样即为成功
此时打开浏览器 输入配置的ip地址 输入默认的账号密码admin/Harbor12345即可登录 此次可以docker登录harbor 上传镜像进行验证
[rootlocalhost 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