我一直在Docker Build上获取错误解析参考

时间:2019-05-30 02:26:20

标签: docker asp.net-core

Sending build context to Docker daemon 7.351 MB
Step 1/12 : FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
Error parsing reference: "mcr.microsoft.com/dotnet/core/sdk:2.2 AS build" is not a valid repository/tag: invalid reference format

这就是我在控制台上得到的。 在Linux上,它完全可以正常工作,但是当我在Windows上尝试相同的代码时,出现此错误。

1 个答案:

答案 0 :(得分:3)

使用AS build时,表示您正在使用从Docker 17.05开始的多阶段构建,请参见this

因此,您需要升级Docker版本,否则您将看到类似下一个的内容:

root@ip-10-23-22-89:/home/ubuntu# docker version
Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:50:17 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:50:17 2017
 OS/Arch:      linux/amd64
 Experimental: false
root@ip-10-23-22-89:/home/ubuntu# docker build -t abc:1 .
Sending build context to Docker daemon  21.5 kB
Step 1/1 : FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
Error parsing reference: "mcr.microsoft.com/dotnet/core/sdk:2.2 AS build" is not a valid repository/tag: invalid reference format