harbor 私有仓库搭建

构建harbor私有仓库

# 包括harbor节点,所以节点都需要执行
cat > /etc/docker/daemon.json <<EOF
{
	"exec-opts": ["native.cgroupdriver=systemd"],
	"log-driver": "json-file",
	"log-opts": {
		"max-size": "100m"
	},
	"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
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 = 192.168.1.100 # 这里设置为主机ip或者是dns
harbor_admin_password = 123456 # 修改admin用户的密码

#创建 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 365 -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
原文地址:https://www.cnblogs.com/HouZhenglan/p/11951336.html