V
vranjan34
Guest
Please help me in resolving this issue, it has become a major blocker for me.
Tools:
1.Microsoft Visual Studio Enterprise 2019
Version 16.7.1
2. Docker Desktop( Docker version 19.03.12, build 48a66213fe)
Issue:
While building images through Dockerfile, it is getting failed while running "dotnet restore command"
If I run the same "dotnet restore command" in command prompt , it is executing successfully.
What I have done till now:
1. I re-installed both VS 2019 and docker desktop, didn't help.
2. I tried to get answers from other forum, didn't help.
DockerFile:
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1 AS base
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS build
WORKDIR /src
COPY ["PatientService/PatientService.csproj", "PatientService/"]
RUN dotnet restore "PatientService/PatientService.csproj"
COPY . .
WORKDIR "/src/PatientService"
RUN dotnet build "PatientService.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "PatientService.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PatientService.dll"]
Output:
1>------ Rebuild All started: Project: PatientService, Configuration: Debug Any CPU ------
1>PatientService -> D:\Projects_Exercise\PatientService\PatientService\bin\Debug\netcoreapp2.1\PatientService.dll
1>Docker version 19.03.12, build 48a66213fe
1>docker build -f "d:\projects_exercise\patientservice\patientservice\dockerfile" --force-rm -t patientservice --label "com.microsoft.created-by=visual-studio" --label "com.microsoft.visual-studio.project-name=PatientService" "d:\projects_exercise\patientservice"
1>Sending build context to Docker daemon 70.66kB
1>
1>Step 1/17 : FROM mcr.microsoft.com/dotnet/core/aspnet:2.1 AS base
1> ---> cd464c4949df
1>Step 2/17 : EXPOSE 80
1> ---> Using cache
1> ---> 113b7b4da631
1>Step 3/17 : FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS build
1> ---> 58b9fa67619f
1>Step 4/17 : WORKDIR /src
1> ---> Using cache
1> ---> 63c1068fe906
1>Step 5/17 : COPY ["PatientService/PatientService.csproj", "PatientService/"]
1> ---> Using cache
1> ---> e9dd2773b565
1>Step 6/17 : RUN dotnet restore "PatientService/PatientService.csproj"
1> ---> Running in 64786399b7ae
1>C:\Program Files\dotnet\sdk\2.1.809\NuGet.targets(123,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\src\PatientService\PatientService.csproj]
1>C:\Program Files\dotnet\sdk\2.1.809\NuGet.targets(123,5): error : No such host is known [C:\src\PatientService\PatientService.csproj]
1>Removing intermediate container 64786399b7ae
1>The command 'cmd /S /C dotnet restore "PatientService/PatientService.csproj"' returned a non-zero code: 1
1>d:\projects_exercise\patientservice\patientservice\dockerfile : error CTC1014: Docker command failed with exit code 1.
1>d:\projects_exercise\patientservice\patientservice\dockerfile : error CTC1014: The command 'cmd /S /C dotnet restore "PatientService/PatientService.csproj"' returned a non-zero code: 1
1>Done building project "PatientService.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Continue reading...
Tools:
1.Microsoft Visual Studio Enterprise 2019
Version 16.7.1
2. Docker Desktop( Docker version 19.03.12, build 48a66213fe)
Issue:
While building images through Dockerfile, it is getting failed while running "dotnet restore command"
If I run the same "dotnet restore command" in command prompt , it is executing successfully.
What I have done till now:
1. I re-installed both VS 2019 and docker desktop, didn't help.
2. I tried to get answers from other forum, didn't help.
DockerFile:
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1 AS base
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS build
WORKDIR /src
COPY ["PatientService/PatientService.csproj", "PatientService/"]
RUN dotnet restore "PatientService/PatientService.csproj"
COPY . .
WORKDIR "/src/PatientService"
RUN dotnet build "PatientService.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "PatientService.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PatientService.dll"]
Output:
1>------ Rebuild All started: Project: PatientService, Configuration: Debug Any CPU ------
1>PatientService -> D:\Projects_Exercise\PatientService\PatientService\bin\Debug\netcoreapp2.1\PatientService.dll
1>Docker version 19.03.12, build 48a66213fe
1>docker build -f "d:\projects_exercise\patientservice\patientservice\dockerfile" --force-rm -t patientservice --label "com.microsoft.created-by=visual-studio" --label "com.microsoft.visual-studio.project-name=PatientService" "d:\projects_exercise\patientservice"
1>Sending build context to Docker daemon 70.66kB
1>
1>Step 1/17 : FROM mcr.microsoft.com/dotnet/core/aspnet:2.1 AS base
1> ---> cd464c4949df
1>Step 2/17 : EXPOSE 80
1> ---> Using cache
1> ---> 113b7b4da631
1>Step 3/17 : FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS build
1> ---> 58b9fa67619f
1>Step 4/17 : WORKDIR /src
1> ---> Using cache
1> ---> 63c1068fe906
1>Step 5/17 : COPY ["PatientService/PatientService.csproj", "PatientService/"]
1> ---> Using cache
1> ---> e9dd2773b565
1>Step 6/17 : RUN dotnet restore "PatientService/PatientService.csproj"
1> ---> Running in 64786399b7ae
1>C:\Program Files\dotnet\sdk\2.1.809\NuGet.targets(123,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\src\PatientService\PatientService.csproj]
1>C:\Program Files\dotnet\sdk\2.1.809\NuGet.targets(123,5): error : No such host is known [C:\src\PatientService\PatientService.csproj]
1>Removing intermediate container 64786399b7ae
1>The command 'cmd /S /C dotnet restore "PatientService/PatientService.csproj"' returned a non-zero code: 1
1>d:\projects_exercise\patientservice\patientservice\dockerfile : error CTC1014: Docker command failed with exit code 1.
1>d:\projects_exercise\patientservice\patientservice\dockerfile : error CTC1014: The command 'cmd /S /C dotnet restore "PatientService/PatientService.csproj"' returned a non-zero code: 1
1>Done building project "PatientService.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Continue reading...