Expected behavior
It should work without any error
Actual behavior
C:\sampleSVC\WebApplication1>docker build -t webapplication1:latest .
Sending build context to Docker daemon 20.99kB
Step 1/17 : FROM aspnet:2.2-nanoserver-sac2016 AS base
—> f74b3b568bbc
Step 2/17 : WORKDIR /app
—> Using cache
—> 7c9d92f0ce8a
Step 3/17 : EXPOSE 80
—> Using cache
—> 2257bd59cd34
Step 4/17 : EXPOSE 443
—> Using cache
—> 214f17dc4a2a
Step 5/17 : FROM sdk:2.2-nanoserver-sac2016 AS build
—> 9773d80bdd64
Step 6/17 : WORKDIR /sampleSVC/WebApplication1
—> Using cache
—> b4c90013962a
Step 7/17 : COPY [“WebApplication1/WebApplication1.csproj”, “WebApplication1/”]
—> Using cache
—> 55425a946187
Step 8/17 : RUN dotnet restore “WebApplication1”
—> Running in f649cf051ecd
Restoring packages for C:\sampleSVC\WebApplication1\WebApplication1\WebApplication1.csproj…
C:\Program Files\dotnet\sdk\2.2.104\NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\sampleSVC\WebApplication1\WebApplication1\WebApplication1.csproj]
C:\Program Files\dotnet\sdk\2.2.104\NuGet.targets(114,5): error : No such host is known [C:\sampleSVC\WebApplication1\WebApplication1\WebApplication1.csproj]
The command ‘powershell -Command $ErrorActionPreference = ‘Stop’; $ProgressPreference = ‘SilentlyContinue’; dotnet restore “WebApplication1”’ returned a non-zero code: 1
Information
Steps to reproduce the behavior
- Development Env : Windows Server 2016 Server and VS 2019
2.Create normal ASP.NET Core 2.2 Web application
3.PFB Post for Docker file.
4.Open command prompt and navigate to .sln and docker file location - Execute this command docker build -t webapplication1:latest .
Can any provide solution for this