flnxi-Wu/scripts/deploy/fix-registry-config.ps1
WuYongJie f646b71813
Some checks failed
CI Check / check (push) Has been cancelled
chore: 初始化本地仓库并同步最近改动
2025-11-18 17:50:16 +08:00

39 lines
1.0 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 修复 Registry 配置
param(
[string]$Server = "45.249.208.118",
[string]$Username = "root",
[string]$Password = "lxvhNYFZ4160"
)
$hostKey = "SHA256:WZOtvC/+IWw29P8vyovSabmIRFkQ/Bnmhj+qhTshA4Q"
$plink = "C:\Program Files\PuTTY\plink.exe"
if (-not (Test-Path $plink)) {
Write-Host "未找到 PuTTY,请手动配置" -ForegroundColor Yellow
exit 1
}
Write-Host "配置 Docker 允许不安全的 Registry..." -ForegroundColor Cyan
# 配置 Docker
$configCmd = @"
cat > /etc/docker/daemon.json << 'EOF'
{
"insecure-registries": ["45.249.208.118:5000"]
}
EOF
systemctl restart docker
echo "Docker配置完成"
"@
& $plink -batch -ssh -hostkey $hostKey -pw $Password "${Username}@${Server}" $configCmd
Write-Host ""
Write-Host "测试 Registry..." -ForegroundColor Cyan
$testCmd = "curl -s http://localhost:5000/v2/ && echo '' && echo 'Registry运行正常'"
& $plink -batch -ssh -hostkey $hostKey -pw $Password "${Username}@${Server}" $testCmd
Write-Host ""
Write-Host "✓ Registry 配置完成" -ForegroundColor Green