目标机器主动拒绝 - Invoke-RestMethod“http://localhost:xxx/api/http/routers

问题描述 投票:0回答:1

当我在设置本地运行 XM Cloud 时运行 up.ps1 脚本时,出现以下错误。

背景:我的系统重新启动后,我遇到了这个问题,docker容器处于退出状态,并且无法重新启动。

尝试修复:我完全删除了所有 docker 容器并运行 up.ps1 脚本再次安装容器,然后脚本运行正常。

安装了 Docker:适用于 Windows 的 docker 并在 Windows 容器中运行

错误:

strconv.Atoi: parsing "": invalid syntax
Waiting for CM to become available...
Invoke-RestMethod: C:\pathtoxmcloudproject\up.ps1:59:19
Line |
  59 |  …   $status = Invoke-RestMethod "http://localhost:xxxx/api/http/routers …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | No connection could be made because the target machine actively refused it.

我尝试删除所有容器并重新运行 up.ps1 脚本。

docker cloud sitecore
1个回答
0
投票

我遇到过这个错误几次,发现可以通过使用

docker network prune

来解决

您可以创建一个新的 PowerShell 脚本来执行以下操作,并将其放置在与您的

up.ps1
脚本相同的级别;

#Requires -RunAsAdministrator

./down.ps1

try {
  Write-Host "Performing 'docker network prune'..." -ForegroundColor Green
  docker network prune --force
  if ($LASTEXITCODE -ne 0) {
    Write-Error "Docker network prune, see errors above."
  }
}
finally {
}

./up.ps1
© www.soinside.com 2019 - 2024. All rights reserved.