Skip to content

An error occurred while attempting to build Docker image #3884

@vinaychandra

Description

@vinaychandra

Information

  • Windows Version: Windows 10 1903
  • Docker for Windows Version: 2.0.4.0 (33772) - Windows Containers

Create new project from ASP.NET Core 3 API template with Enable Docker Support checked. This is the sample DockerFile

#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 https://aka.ms/containercompat

FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

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

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

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

This is the full build output when trying to run the image from VS 2019

1>------ Build started: Project: WebApplication1, Configuration: Debug Any CPU ------
1>C:\Program Files\dotnet\sdk\3.0.100-preview5-011568\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(157,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
1>WebApplication1 -> C:\Users\vinay\source\repos\WebApplication1\WebApplication1\bin\Debug\netcoreapp3.0\WebApplication1.dll
1>docker build -f "C:\Users\vinay\source\repos\WebApplication1\WebApplication1\Dockerfile" -t webapplication1:dev --target base  --label "com.microsoft.created-by=visual-studio" --label "com.microsoft.visual-studio.project-name=WebApplication1" "C:\Users\vinay\source\repos\WebApplication1"
1>Sending build context to Docker daemon  19.97kB
1>
1>Step 1/6 : FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-nanoserver-1809 AS base
1> ---> 03ea2d12b576
1>Step 2/6 : WORKDIR /app
1> ---> Running in b43c8006530c
1>hcsshim::PrepareLayer - failed failed in Win32: Incorrect function. (0x1)
1>C:\Users\vinay\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.7.8\build\Container.targets(196,5): error CTP1001: An error occurred while attempting to build Docker image.
1>Done building project "WebApplication1.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Note that I am able to login (docker login works) but the build fails in another step.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions