我试图在azure管道上构建基础映像,但是从Microsoft拉出安装程序时,连接被拒绝。
来自install dotnet samples的Dockerfile:
# escape=`
FROM mcr.microsoft.com/windows/servercore:1607
RUN powershell -Command `
$ErrorActionPreference = 'Stop'; `
$ProgressPreference = 'SilentlyContinue'; `
Invoke-WebRequest `
-UseBasicParsing `
-Uri https://dot.net/v1/dotnet-install.ps1 `
-OutFile dotnet-install.ps1; `
./dotnet-install.ps1 `
-InstallDir '/Program Files/dotnet' `
-Channel 3.0 `
-Runtime dotnet; `
Remove-Item -Force dotnet-install.ps1 `
&& setx /M PATH "%PATH%;C:\Program Files\dotnet"
日志:
##[section]Starting: Build an image
==============================================================================
Task : Docker
Description : Build or push Docker images, login or logout, or run a Docker command
Version : 2.160.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/docker
==============================================================================
a2745d43-956f-4450-9ff4-25ef833410b3 exists true
[command]"C:\Program Files\Docker\docker.exe" build -f d:\a\8\s\Docker\Docker\wservercore-dotnetcore3.0.Dockerfile --label com.azure.dev.image.system.teamfoundationcollectionuri=https://dev.azure.com/SspCtt/ --label com.azure.dev.image.system.teamproject=GOD --label com.azure.dev.image.build.repository.name=GOD --label com.azure.dev.image.build.sourceversion=4 --label com.azure.dev.image.build.repository.uri=https://dev.azure.com/SspCtt/ --label com.azure.dev.image.build.sourcebranchname=GOD --label "com.azure.dev.image.build.definitionname=Build servicecore-dotnetcore3.0 image" --label com.azure.dev.image.build.buildnumber=20191204.4 --label com.azure.dev.image.build.builduri=vstfs:///Build/Build/4 -t dockerhub:4 d:\a\8\s\Docker\Docker
Sending build context to Docker daemon 2.56kB
Step 1/11 : FROM mcr.microsoft.com/windows/servercore:1607
1607: Pulling from windows/servercore
3889bb8d808b: Already exists
57e8a97eaa75: Pulling fs layer
57e8a97eaa75: Verifying Checksum
57e8a97eaa75: Download complete
57e8a97eaa75: Pull complete
Digest: sha256:f5d4abf787650d742504be54e97f62874722b0747ad204108610dd25b2d66cd0
Status: Downloaded newer image for mcr.microsoft.com/windows/servercore:1607
---> 5b0fdc7e6814
Step 2/11 : RUN powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -UseBasicParsing -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1; ./dotnet-install.ps1 -InstallDir '/Program Files/dotnet' -Channel 3.0 -Runtime dotnet; Remove-Item -Force dotnet-install.ps1 && setx /M PATH "%PATH%;C:\Program Files\dotnet"
---> Running in 56585c5966de
[91mInvoke-WebRequest : The underlying connection was closed: An unexpected error
[0m[91moccurred on a send.
At line:1 char:76
[0m[91m+ ... yContinue'; Invoke-WebRequest -UseBasicParsing -Uri https://dot.net/v ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[0m[91m + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt
pWebRequest) [Invoke-WebRequest], WebException
[0m[91m + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
ll.Commands.InvokeWebRequestCommand
[0m[91m
[0mThe command 'cmd /S /C powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -UseBasicParsing -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1; ./dotnet-install.ps1 -InstallDir '/Program Files/dotnet' -Channel 3.0 -Runtime dotnet; Remove-Item -Force dotnet-install.ps1 && setx /M PATH "%PATH%;C:\Program Files\dotnet"' returned a non-zero code: 1
##[error]The process 'C:\Program Files\Docker\docker.exe' failed with exit code 1
##[section]Finishing: Build an image