Getting error while creating docker image visual studio core 3.1

abinash

New member
Joined
Aug 18, 2020
Messages
1
Programming Experience
5-10
Hi Team,
I am getting error in (RUN dotnet restore "LatestCoreAppForDocker/LatestCoreAppForDocker.csproj") line while create image file using Power-shell script.

I am using below command to create image file.
PS C:\Abinash\Interview\Microservices\DockerASPAppication> docker build --tag tagone -f latestcoreappfordocker/dockerfile .

Below is my docker file.

--------------------------------------------------------------------------------------------------------------------
C#:
#See Visual Studio Container Tools build and debug overview - Visual Studio to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see Windows Container Version Compatibility

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1809 AS base
WORKDIR /Abinash/Interview/Microservices/DockerASPAppication/LatestCoreAppForDocker
EXPOSE 80

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809 AS build
WORKDIR /src
COPY ["LatestCoreAppForDocker/LatestCoreAppForDocker.csproj", "LatestCoreAppForDocker/"]
RUN dotnet restore "LatestCoreAppForDocker/LatestCoreAppForDocker.csproj"
COPY . .
WORKDIR "/src/LatestCoreAppForDocker"
RUN dotnet build "LatestCoreAppForDocker.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "LatestCoreAppForDocker.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "LatestCoreAppForDocker.dll"]
---------------------------------------------------------------------------------------------------

1597740227317.png
 
Last edited by a moderator:
In the future please put code and transcripts in code tags. Avoid screenshots as they can be hard to read.

Anyway, after squinting at the screenshot, it gives you a hint of something going wrong right before the error. It says that Nuget was unable to get the service index from some URL.

I would suggest trying to clear your docker cache and trying a clean docker build first to see if the fixes the issue. If not, then it maybe that your docker image is unable to access the Internet due to some AV settings, or firewall rules.
 
Back
Top Bottom