Docker Community Forums

Share and learn in the Docker community.

Publish .Net Core API application to Docker

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 AS base

FROM AS build
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
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 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
-03T09%3A56%3A41Z&sig=n%2Bn5XtoYlzjYD6Iet2CdxbHg2aXOKwkU2sZ2z3ZpETs%3D&sp=r&sr=b&sv=2016-05-31&regid=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?