基于 harbor-offline-installer-v2.3.2.tgz 搭建私有镜像仓库。
前置条件
1 | 1. 安装docker |
生成证书
1 | mkdir -p /data/cert && chmod -R 777 /data/cert && cd /data/cert |
部署安装
1 | tar -zxvf harbor-offline-installer-v2.3.2.tgz |
编辑harbor.yml,修改hostname、https证书路径、admin密码
1 | hostname: hub.me.io |
运行install.sh即可(可带参数–with-notary启用镜像签名,–with-clair启用漏洞扫描)
**流程:**检查环境 -> 导入镜像 -> 准备环境 -> 准备配置(含移除旧版本)-> 开始启动
1 | [root@docker-registry harbor] ./install.sh --with-notary --with-clair |
访问80端口即可
开机启动
1 | vim /usr/lib/systemd/system/harbor.service |
1 | systemctl enable harbor.service |
数据挂载到 /data 目录下面
配置镜像加速地址
1 | cat > /etc/docker/daemon.json <<EOF |
其它机器如何使用私服
修改配置 ,新增下面的配置
vim /etc/docker/daemon.json
1
"insecure-registries": ["192.168.18.120"]
完整配置
1
2
3
4
5
6
7
8
9
10{
"exec-opts": [
"native.cgroupdriver=systemd"
],
"log-driver": "json-file",
"insecure-registries": ["192.168.18.120"],
"log-opts": {
"max-size": "100m"
}
}重启docker
1
systemctl restart docker
验证是否成功 docker info
1
2
3Insecure Registries:
192.168.18.120
127.0.0.0/8