docker registry v2 push "unauthorized: authentication required" 问题解决办法
因为急着上车,实在来不及解释了。
以下内容转自http://dockone.io/article/865
[~]# docker push docker-registry.genouest.org/osallou/blast The push refers to a repository [docker-registry.genouest.org/osallou/blast] (len: 1) 3acbd84b58f1: Pushing 1.024 kB unauthorized: authentication required
大致问题如上。
环境
nginx+registry:v2+auth-server
docker 1.9
So
往往你login没问题,push就报错了。
并且日志中发现不了什么问题。
问题的大致剖析(不够细致)
你可以大致理解成,login的时候,回话只进行了一次,并且都走了https协议,所以没有出现问题。
而push操作,分为2步:
验证: 和login类似,多了步去查你的权限;
push: 这里恰恰出了问题,因为它走了http的协议,相关规则的文件:(https://github.com/docker/dist … ls.go )
而重新走了http的内容,会被认为是401的,所以会出了上边的报错。
解决方法
nginx代理中加入
proxy_set_header X-Forwarded-Proto https;
issue:https://github.com/docker/distribution/issues/1177
还有一些其他的原因,我这里没遇到,也贴出来issue:(https://github.com/docker/distribution/issues/1165),这个大概是由于端口配置的问题。