Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11721

Can't download Azure DevOps agent during Docker Container build

$
0
0

So, this is a very weird issue and I can't figure it out... I'm following MS documentation on running the DevOps agent from a Docker container, and the following code is always failing.

Print-Header "1. Determining matching Azure Pipelines agent..."$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$(Get- Content ${Env:AZP_TOKEN_FILE})"))$package = Invoke-RestMethod -Headers @{Authorization = ("Basic $base64AuthInfo") } "$(${Env:AZP_URL})/_apis/distributedtask/packages/agent?platform=win-x64&`$top=1"$packageUrl = $package[0].Value.downloadUrlWrite-Host $packageUrlPrint-Header "2. Downloading Azure Pipelines agent..."$wc = New-Object System.Net.WebClient$wc.DownloadFile("$packageUrl", ".\agent.zip")

with the error

Exception calling "DownloadFile" with "2" argument(s): "The operation has timed out"At C:\azagent\agentGet.ps1:39 char:1$wc.DownloadFile("https://vstsagentpackage.azureedge.net/agent/3.232. ...CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordExceptionFullyQualifiedErrorId : WebException

Here's why it's confusing...

  1. The same script works from the host computer (so it's not host-URL connectivity)
  2. The dockerfile has instructions, before running that code, to download java from the internet, which is also working, so it's not the process not having access to the internet
  3. Replacing the WebClient with an Invoke-RestMethod call just hangs forever, highlighting that it can't reach the URL

Viewing all articles
Browse latest Browse all 11721

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>