下载安装包
在 harbor 版本 下载需要的在线或离线安装包
-
下载安装包
以离线安装包为例
wget https://github.com/goharbor/harbor/releases/download/v2.8.2/ harbor-offline-installer-v2.8.2.tgz
-
解压
tar -zxvf harbor-offline-installer-v2.8.2.tgz harbor/harbor.v2.8.2.tar.gz harbor/prepare harbor/LICENSE harbor/install.sh harbor/common.sh harbor/harbor.yml.tmpl
修改harbor.yml
-
修改文件名
mv harbor.yml.tmpl harbor.yml
-
编辑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: test.harbor.com # 设置hostname # http related config http: # port for http, default is 80. If https enabled, this port will redirect to https port port: 80 # 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 .......
安装docker-compose
-
下载docker-compose
从docker-compose版本下载对应的文件sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
-
给docker-compose执行权限
chmod +x /usr/local/bin/docker-compose
部署Harbor
-
运行脚本 prepare
./prepare
-
运行脚本 install.sh 以安装Harbor
./instal.sh
本地登录
-
配置hosts文件即可实现本地登录
vi /etc/hosts # 添加如下内容 部署harbor的服务器地址 harbor域名 192.168.0.3 harbor.com
-
登录
用户名密码已在harbor.yml中设置,默认为admin/harbor12345 docker login harbor.com Username: admin Password: Error response from daemon: Get "https://test.harbor.com/v2/": dial tcp 192.168.0.4:443: connect: connection refused 这个原因是访问 HTTPS 被拒绝(我们只配置了 HTTP),需要关闭安全验证。修改 /etc/docker/daemon.json
-
修改 /etc/docker/daemon.json
+ "insecure-registries": ["test.harbor.com", "0.0.0.0"]
-
重启 Docker
sudo systemctl restart docker
-
在安装 Harbor 的机器上重启 Harbor
cd harbor docker-compose down -v docker-compose up -d
-
登录
docker login test.harbor.com 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-store Login Succeeded
WEB登录
harbor安装后,默认的端口是443,访问 https://localhost:80 即可登录,若是云服务器则需要做端口转发
标签:compose,HTTP,Harbor,部署,https,harbor,docker,com From: https://www.cnblogs.com/sunshinefly/p/17713201.html