搭建harbor仓库教程

1.安装docker

配置yum源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装18.06
yum install -y docker-ce-18.06.0.ce-3.el7

2.安装Docker-compose直接下载二进制安装包

curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
curl -SL https://github.com/docker/compose/releases/download/v2.17.2/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

3.在线安装下载harbor online包

wget https://github.com/goharbor/harbor/releases/download/v2.5.1/harbor-online-installer-v2.5.1.tgz
tar zxvf harbor-online-installer-v2.5.1.tgz -C /data
cd /data/harbor
cp harbor.yml.tmpl harbor.yml
vim harbor.yml
把https注释掉,或者配置证书

hostname: 10.10.1.100
	http:
	port: 8088
	# https related config
	#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
	data_volume: /data/harbor-data/

​ (在线下载images直接执行安装)./install.sh
完成

或者已下载下来的images tar包上传
docker load -i harbor-core.tar
docker load -i harbor-db.tar
docker load -i harbor-jobservice.tar
docker load -i harbor-log.tar
docker load -i harbor-nginx-photon.tar
docker load -i harbor-portal.tar
docker load -i harbor-redis-photon.tar
docker load -i harbor-regestryctl.tar
docker load -i harbor-registry-photon.tar
docker load -i prepare.tar
之后再执行./install.sh 更快

4.离线安装包

4.1上传离线安装包和所需的prepare.tar包

tar xf harbor-offline-installer-v2.5.3.tgz -C /data
cd /data/harbor
cp harbor.yml.tmpl harbor.yml

4.2 vim harbor.yml

把https注释掉,或者配置证书

hostname: 10.10.0.11
	http:
	port: 8088
	# https related config
	#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
	data_volume: /data/harbor-data/

4.3加载goharbor-prepare.tar

docker load -i goharbor-prepare.tar

4.4新配置文件重新生成docker-compose文件

./prepare

4.5根据新生成的docker-compos文件,运行如下命令进行安装

./install.sh

harbor 的停止与启动
docker-compose down 停止
docker-compose up -d 后台启动

你可能感兴趣的:(1024程序员节)