配置docker默认镜像仓库
//包括harbor节点,所有节点都需要执行
cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
//让服务器信任harbor
"insecure-registries": ["https://hub.ko.com"]
}
EOF
systemctl restart docker
//以下内容只需要在 harber 节点执行
//下载docker-commpose
curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
// 为docker-commpose添加权限
chmod +x /usr/local/bin/docker-commpose
//验证查看docker-compose版本
docker-commpose --version
安装 harbor仓库
//下载harbor私有仓库安装包
wget https://storage.googleapis.com/harbor-releases/harbor-offline-installer-v1.5.3.tgz
tar -xf harbor-offline-installer-v1.5.3.tgz
mv harbor /opt/
cd /opt/harbor
//配置
vim harbor.cfg
hostname = hub.ko.com # 这里设置为主机ip或者是dns
harbor_admin_password = 123456 # 修改admin用户的密码
//创建 harbor https 证书以及配置
openssl genrsa -des3 -out server.key 2048
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt
mkdir /data/cert -p
cp * /data/cert
chmod +x /data/cert/*
./prepare # 配置harbor
./install.sh # 安装 harbor
打开浏览器测试
//修改hosts
192.168.1.3 hub.ko.com
//在浏览器中打开网站
https://hub.ko.com