下载文件, 解压到/usr/local/harbor目录下
cd /usr/local/harbor
cp harbor.yml.tmpl harbor.yml
vi harbor.yml
修改hostname配置, 注释掉https相关配置
hostname: 192.168.52.91
#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
./install.sh
账密: admin:Harbor12345

修改/etc/docker/daemon.json中的镜像添加harbor
# 添加harbor的地址
vi /etc/docker/daemon.json
{
"registry-mirrors": ["<https://m02f91ga.mirror.aliyuncs.com>"],
"insecure-registries": ["192.168.52.91:80"]
}
修改标签仓库地址,推送镜像到harbor
# 修改标签仓库
docker tag 0adf23b9f457 192.168.52.91:80/repo/mytest:v1
# 登录harbor
docker login -u admin -p Harbor12345 192.168.52.91:80
# 推送镜像到harbor
docker push 192.168.52.91:80/repo/mytest:v1
删除原始的mytest镜像, 从harbor上拉取镜像
# 删除mytest镜像
docker rmi -f 0adf23b9f457
# 从harbor上拉取镜像
docker pull 192.168.52.91:80/repo/mytest:v1