[英]Authenticate with Docker registry API
我正在尝试通过https://registry-1.docker.io/v1/上的Docker注册表API进行身份验证
我正在尝试打电话
https://registry-1.docker.io/v1/repositories/_/ubuntu/tags
但是我不断收到如下回复:
401
{ server: 'gunicorn/18.0',
date: 'Sun, 01 Mar 2015 12:19:13 GMT',
connection: 'close',
expires: '-1',
'content-type': 'application/json',
'www-authenticate': 'Token',
pragma: 'no-cache',
'cache-control': 'no-cache',
'content-length': '35',
'x-docker-registry-version': '0.8.2',
'x-docker-registry-config': 'prod',
'strict-transport-security': 'max-age=31536000' }
{"error": "Requires authorization"}
遵循这些准则,我首先向HUB身份验证并请求令牌。 这样就可以了,我从HUB获得了令牌和cookie。 然后,我将所有这些信息提供给Registry API,如下所示:
{
'set-cookie': 'csrftoken=VfHe6...; Expires=Sun, 28 Feb 2016 12:19:13 GMT; Max-Age=31449600; Path=/; Secure',
'www-authenticate': 'Token signature=VfHe6...,repository="ubuntu",access=read',
'x-docker-token': 'Token signature=VfHe6...,repository="ubuntu",access=read',
Authenticate: 'Token signature=VfHe6...,repository="ubuntu",access=read',
Authorization: 'Token signature=VfHe6...,repository="ubuntu",access=read'
}
您共享的文档中有以下一行:
Token is only returned when the X-Docker-Token header is sent with request.
在集线器上进行身份验证时,需要发送“ X-Docker-Token:true”,然后在标头中收到“ X-Docker-Token”。 将其作为“授权:”发送到“ X-Docker-Endpoints”中的注册表,您就可以进入。
祝好运! :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.