Mohan Gopi
Mohan Gopi

Reputation: 247

Failed to build: Error parsing reference: "microsoft/dotnet:2.1-runtime AS base" is not a valid repository/tag:

I got the below error when build docker for console application using .net core.

Step 1/15 : FROM microsoft/dotnet:2.1-runtime AS base Error parsing reference: "microsoft/dotnet:2.1-runtime AS base" is not a valid repository/tag: invalid reference format

My Dockerfile looks below

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ConsoleApp2/ConsoleApp2.csproj ConsoleApp2/
RUN dotnet restore ConsoleApp2/ConsoleApp2.csproj
COPY . .
WORKDIR /src/ConsoleApp2
RUN dotnet build ConsoleApp2.csproj -c Release -o /app

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

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

My docker version is

Docker version 17.03.1-ce-rc1, build 3476dbf

Can some one suggest what I am doing wrong in this. Thanks in advance.

Upvotes: 1

Views: 698

Answers (1)

BMitch
BMitch

Reputation: 263976

Multi-stage builds (which added the FROM ... AS ... syntax along with multiple FROM lines) require 17.05 or newer. You'll need to upgrade your docker server.

For more details on multi-stage builds, see: https://docs.docker.com/develop/develop-images/multistage-build/

Upvotes: 1

Related Questions