- 安装Docker
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager \
--add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' \
/etc/yum.repos.d/CentOS-Base.repo
yum install docker-ce-19.03.* docker-ce-cli-19.03.* -y
systemctl daemon-reload &&systemctl enable --now docker
2、安装完成后,将下载的Harbor离线包解压并载入Harbor镜像:
tar xf harbor-offline-installer-v2.3.2.tgz
cd harbor
docker load -i harbor.v2.3.2.tar.gz
3、安装Compose
curl -L
"https://github.com/docker/compose/releases/download/1.29.2/docker-compose-
$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose -v
4、Harbor默认提供了一个配置文件模板,需要更改如下字段
cp harbor.yml.tmpl harbor.yml
vi harbor.yml
hostname:Harbor的访问地址,可以是域名或者IP
5、创建Harbor数据目录并进行预配置
mkdir /data/harbor/var/log/harbor -p
./prepare
- 执行安装
./install.sh
7、成功启动后,即可通过配置的地址或域名访问
8、如果配置不是https协议,所有的Kubernetes节点的Docker都需要添加insecure-registries配置:
(如果是containerd作为Runtime,可以参考下文配置insecure-registry)
vi /etc/docker/daemon.json
systemctl daemon-reload
systemctl restart docker
9、如果Kubernetes集群采用的是Containerd作为的Runtime,配置insecure-registry只需要在Containerd配置文件的mirrors下添加自己的镜像仓库地址即可
vim /etc/containerd/config.toml
配置完成后,重启Containerd
systemctl restart containerd
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."192.168.0.190"]
endpoint= ["https://192.168.0.190"]