一、安装准备

harbor下载地址:https://github.com/goharbor/harbor/releases
harbor官方文档:https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md
docker-compose下载地址:https://github.com/docker/compose/releases/
docker-compose官方文档:https://docs.docker.com/compose/install/

环境版本
Centos7.6.1810
harbor1.8.1
docker-compose1.24.1
docker-ce18.09.7
Openssl1.0.2

二、安装openssl

yum install -y openssh-clients

查看版本

[root@localhost ~]# openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017

三、安装docker-ce

docker-ce安装文档:https://blog.csdn.net/qq_39680564/article/details/86545098

四、安装docker-compose

wget https://github.com/docker/compose/releases/download/1.24.1/docker-compose-Linux-x86_64 -O /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

查看版本

[root@localhost ~]# docker-compose --version
docker-compose version 1.24.1, build 4667896b

五、安装harbor

5.1下载安装程序

wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.1.tgz
tar -zxvf harbor-offline-installer-v1.8.1.tgz

5.2配置harbor.yml

vim harbor/harbor.yml

必填参数,不会改的使用默认就行

hostname: 192.168.0.222	#主机名,例如:192.168.1.10或reg.yourdomain.com。不要使用localhost或127.0.0.1作为主机名
data_volume: /data	#存储harbor数据的位置
harbor_admin_password: Harbor12345	#管理员的初始密码,默认用户名/密码为admin/Harbor12345
database:
	password: root123	#用于db_auth的PostgreSQL数据库的root密码
jobservice:
	max_job_workers: 10	#最大同时工作者数
log:
	level: info	#日志等级,debug, info, warning, error, fatal
	rotate_count: 50
	rotate_size: 200M
	location: /var/log/harbor	#存储日志的目录

选填参数

http:
	port: 28083	#http的端口号
https:	#如果启用了公证,则必须设置为https
	port: 443	#https的端口号
	certificate: /your/certificate/path	#SSL证书的路径,仅在协议设置为https时应用
	private_key: /your/private/key/path	#SSL密钥的路径,仅在协议设置为https时应用

5.3运行install.sh安装并启动Harbor

执行安装

[root@localhost harbor]# ./install.sh

安装成功

[Step 3]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating registryctl ... done
Creating redis       ... done
Creating registry    ... done
Creating harbor-db   ... done
Creating harbor-core ... done
Creating harbor-portal     ... done
Creating harbor-jobservice ... done
Creating nginx             ... done

✔ ----Harbor has been installed and started successfully.----

Now you should be able to visit the admin portal at http://192.168.0.222. 
For more details, please visit https://github.com/goharbor/harbor .

5.4 修改配置文件

vim /etc/docker/daemon.json

新增 "insecure-registries" : ["192.168.1.40"],harbor地址

{
  "data-root":"/home/docker",
  "insecure-registries" : ["192.168.1.40"],
  "registry-mirrors": ["https://1e7waog4.mirror.aliyuncs.com"]
}

重启docker

systemctl daemon-reload && systemctl restart docker

5.5 使用harbor

docker login 192.168.1.40
docker tag SOURCE_IMAGE[:TAG] 192.168.1.40/liuli-dev/IMAGE[:TAG]
docker push 192.168.1.40/liuli-dev/IMAGE[:TAG]
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐