docker 构建未经授权:需要身份验证

docker build giving unauthorized: authentication required

我的 docker 版本是

Docker version 1.12.2-cs2-ws-beta, build 050b611

我正在尝试使用命令构建图像

docker build -t iis-dockerfile .

DockerFile 内容为

FROM microsoft/iss
RUN echo "Hello World - Dockerfile" > C:\inetpub\wwwroot\index.html

config.json 是

{
    "auths": {
        "https://index.docker.io/v1/": {
            "auth": <somekey>
        }
    }
}

在 运行 docker 构建时,出现错误

Sending build context to Docker daemon 2.048 kB
Step 1/2 : FROM microsoft/iss
unauthorized: authentication required

我已经完成 docker 登录。 config.json 就是这样创建的。我是容器的新手,正在学习入门教程 https://blogs.msdn.microsoft.com/allthingscontainer/2016/09/15/windows-containers-getting-started-a-step-by-step-guide/。知道我该如何解决这个问题。

我还发现 docker pull 对我有用。虽然这也需要身份验证

只是一个观察。确保您的 docker 文件具有正确的基本图像名称。您确定要 FROM microsoft/iss 而不是 FROM microsoft/iis 吗?

当我尝试使用正确的基础图像创建新图像时。好像还行。

Docker docker build -t test-iid .
Sending build context to Docker daemon 344.9 MB
Step 1/2 : FROM microsoft/iis
latest: Pulling from microsoft/iis
3889bb8d808b: Downloading
3430754e4d17: Downloading
7aee39cd34f9: Downloading [>                                                  ]   540 kB/122.7 MB
5b8e6b632025: Download complete
e067d71858d2: Download complete