I have created a new .Net Core API application and I want to host it in Docker container.
I have downloaded Docker Toolbox, Created a docker File in my application as below:
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-nanoserver-sac2016 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-nanoserver-sac2016 AS build
WORKDIR /src
COPY ["BuySellApi/BuySellApi.csproj", "BuySellApi/"]
COPY ["BuySellApi.Data/BuySellApi.Data.csproj", "BuySellApi.Data/"]
COPY ["../BuySellApi.Core/BuySellApi.Core.csproj", "../BuySellApi.Core/"]
RUN dotnet restore "BuySellApi/BuySellApi.csproj"
COPY . .
WORKDIR "/src/BuySellApi"
RUN dotnet build "BuySellApi.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "BuySellApi.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "BuySellApi.dll"]
After this, I tried to build application using docker using below command:
E:\Apps\trunk\BuySell\BuySellApi>docker build -t dockerapi .
But getting error as below:
Sending build context to Docker daemon 19.1MB
Step 1/18 : FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-nanoserver-sac2016 AS base
2.2-nanoserver-sac2016: Pulling from dotnet/core/aspnet
bce2fbc256ea: Downloading
6f2071dcd729: Downloading
96753c4f1313: Pulling fs layer
3488335bcf0e: Waiting
d42342568b7b: Waiting
d597088c76fb: Waiting
041da94be06b: Waiting
error pulling image configuration: Get https://mcrea0.cdn.mscr.io/b29889755b1f4e46b6b44eb3182530c5-0joxcrfl25//docker/registry/v2/blobs/sha256/f7/f74b
3b568bbcf17cc1df14eb41530242378dca476acf4013a3e26d4d20360478/data?P1=1556877401&P2=1&P3=1&P4=WpygmtpfodtA54TWfIBPpve1g3VuSQKYWqYH4Ek0xko%3D&se=2019-05
-03T09%3A56%3A41Z&sig=n%2Bn5XtoYlzjYD6Iet2CdxbHg2aXOKwkU2sZ2z3ZpETs%3D&sp=r&sr=b&sv=2016-05-31®id=b29889755b1f4e46b6b44eb3182530c5: dial tcp 204.79
.197.219:443: getsockopt: connection refused
Is it because of any Proxy? Because I’m trying it in my office network. If yes, how can I config proxy so that I can build this smoothly?