Harbor 依赖于 Docker 和 Docker compose组件,在此之前我的云上已经预安装了Docker CE 19.03.9版本
下载goharbor
https://github.com/goharbor/harbor/releases
1. 上传到服务器,进行解压缩
tar -zxf harbor-offline-installer-v2.1.3.tgz -C /usr/local/
**2. 修改配置文件**
cd /usr/local/harbor/
cp harbor.yml.tmpl harbor.yml
vim harbor.yml
hostname: 101.xxx.xxx.xxx // 修改为云公网或本机IP
#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 // admin 密码
3. 执行安装脚本
./install.sh
如果你没有安装docker-compose,那么安装过程中,会报Failed to parse docker-compose version
错误
此时,执行docker-compose -version 命令会出现docker-compose: command not found
,去安装一下docker-compose
yum -y install epel-release
yum install python-pip
wget https://github.com/docker/compose/releases/download/1.14.0-rc2/docker-compose-Linux-x86_64
mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
chmod 755 /usr/local/bin/docker-compose
#验证下docker-compose是否安装成功
docker-compose -version
升级docker-compose
Need to upgrade docker-compose package to 1.18.0+错误的解决办法
同安装Docker-Compose,只是修改其中的版本,版本可在https://github.com/docker/compose/releases中查看
curl -L https://github.com/docker/compose/releases/download/1.27.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
如果碰到ERROR: for proxy Cannot create container for service proxy: Conflict. The container name "/nginx" is already in use by container "36f2af3d027841fa08e14d36e9bf0da2480633624b4fcc1fc12baceb621e26dc". You have to remove (or rename) that container to be able to reuse that name.
docker rename nginx nginx_1.22.0
重命名下冲突的容器名
如果碰到ERROR: for proxy Cannot start service proxy: driver failed programming external connectivity on endpoint nginx (f9adabaa890d0917bd767445971f48f7b99cdf2e745cffe8ef82e3ccb8ef057d): Bind for 0.0.0.0:80 failed: port is already allocated
说明端口被占用,配置文件harbor.yml里改下端口
提示✔ ----Harbor has been installed and started successfully.----
,表示安装成功.
验证操作
访问网页配置用户
后面就是上传镜像的操作,到这里就不介绍了
另外,重启harbor命令如下:
docker-compose down
./prepare
docker-compose up –d
以上内容,参考文章:解决docker-compose: command not found问题的两种常用方法
注意:本文归作者所有,未经作者允许,不得转载