首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >docker如何设法获得返回码200而不是401

docker如何设法获得返回码200而不是401
EN

Stack Overflow用户
提问于 2014-06-21 18:41:43
回答 1查看 933关注 0票数 1

在工作中,docker无法拉取图像:

代码语言:javascript
复制
[b209d3c5] +job pull(ubuntu, )
[debug] registry.go:372 [registry] Calling GET https://index.docker.io/v1/repositories/ubuntu/images
[debug] http.go:160 https://index.docker.io/v1/repositories/ubuntu/images -- HEADERS: map[User-Agent:[docker/1.0.0 go/go1.2.2 git-commit/63fe64c kernel/3.15.1-1-ARCH os/linux arch/amd64]]
[debug] server.go:1182 Retrieving the tag list
[debug] http.go:160 https://cdn-registry-1.docker.io/v1/repositories/library/ubuntu/tags -- HEADERS: map[User-Agent:[docker/1.0.0 go/go1.2.2 git-commit/63fe64c kernel/3.15.1-1-ARCH os/linux arch/amd64]]
[debug] registry.go:327 Got status code 401 from https://cdn-registry-1.docker.io/v1/repositories/library/ubuntu/tags
[error] server.go:1185 Could not reach any registry endpoint
Could not reach any registry endpoint
[b209d3c5] -job pull(ubuntu, ) = ERR (1)

如果我手动尝试访问第二个URL,它也会可靠地产生401。

然而,在家里,同样的命令以某种方式成功地检索到了标签:

代码语言:javascript
复制
[4e9acee4] +job pull(ubuntu, )
[debug] registry.go:372 [registry] Calling GET https://index.docker.io/v1/repositories/ubuntu/images
[debug] http.go:160 https://index.docker.io/v1/repositories/ubuntu/images -- HEADERS: map[User-Agent:[docker/1.0.0 go/go1.2.2 git-commit/63fe64c kernel/3.14.6-1-ARCH os/linux arch/amd64]]
[debug] server.go:1182 Retrieving the tag list
[debug] http.go:160 https://cdn-registry-1.docker.io/v1/repositories/library/ubuntu/tags -- HEADERS: map[User-Agent:[docker/1.0.0 go/go1.2.2 git-commit/63fe64c kernel/3.14.6-1-ARCH os/linux arch/amd64]]
[debug] registry.go:327 Got status code 200 from https://cdn-registry-1.docker.io/v1/repositories/library/ubuntu/tags
[debug] server.go:1197 Registering tags
[...]

问题是:这个docker实例是如何获得200的结果的?

有没有检查通信的好方法?(Wireshark可能不好,因为https是完全加密的。)

可能唯一的方法就是读取source code。但我对go语言了解不多。

你能想出更好的解决方案吗,我自己构建docker并添加一些调试打印?

EN

回答 1

Stack Overflow用户

发布于 2014-06-21 19:51:53

看起来REST调用requires是一个有效的Authorization: Token ...头。公司代理似乎也打破了这个头。:(

从源代码构建docker真的很轻松。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24340783

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档