Search code examples
c#dockerasp.net-corewechat

I failed at :docker build -t my_aspnetcore .the brief error info is :invalid reference format


I want to create a docker image for my Asp.net Core application. The environment is CentOS7.5, and dotnet-sdk-2.1.500. Here is the full error message when I enter the command.

docker build -t wechat .: Sending build context to Docker daemon 1.547 MB Step 1/17 : FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base Error parsing reference: "microsoft/dotnet:2.1-aspnetcore-runtime AS base" is not a valid repository/tag: invalid reference format

Sending build context to Docker daemon 1.547 MB Step 1/17 : FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base Error parsing reference: "microsoft/dotnet:2.1-aspnetcore-runtime AS base" is not a valid repository/tag: invalid reference format

I wonder is there any setup I did wrong? How can I get through it?


Solution

  • For invalid reference format, it is usually caused by the wrong docker version.

    For FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base, it uses the docker new feature named multi-stage builds which requires Docker 17.05 or higher.

    Try to follow Get Docker CE for CentOS to reinstall or upgrade your docker ce.