Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker hub私有注册表中的Docker远程api拉取_Docker_Dockerpy - Fatal编程技术网

Docker hub私有注册表中的Docker远程api拉取

Docker hub私有注册表中的Docker远程api拉取,docker,dockerpy,Docker,Dockerpy,我正在尝试使用docker远程API从docker hub中托管的私有存储库中提取docker映像,就像这样。对于如何在像这样的POST请求中指定身份验证凭据,尚不清楚 curl -XPOST -H "X-Registy-Auth: base64_encoded_authconfig_object" "http://localhost:4243/images/create?fromImage=myname/myapp" 也没有详细说明authconfig是如何生成的 讨论使用如下结构发送bas

我正在尝试使用docker远程API从docker hub中托管的私有存储库中提取docker映像,就像这样。对于如何在像这样的POST请求中指定身份验证凭据,尚不清楚

curl -XPOST -H "X-Registy-Auth: base64_encoded_authconfig_object" "http://localhost:4243/images/create?fromImage=myname/myapp"
也没有详细说明authconfig是如何生成的

讨论使用如下结构发送base 64编码的json:

{
  "index_url": {
    "username": "string",
    "password": "string",
    "email": "string",
    "serveraddress": "string"
  }
}
但是没有解释什么是索引url和服务器地址。是吗

index_url = https://registry.hub.docker.com/u/myname/myapp
serveraddress = https://registry.hub.docker.com
上面的配置给了我404,可能是注册表中心私有repo没有被识别

我还尝试用base 64编码我的~/.dockercfg的内容

{
  "https://index.docker.io/v1/": {
    "auth":"xxxxxxxxxxxxxxxxxxx==",
    "email":"myname@myemail.com"
  }
}
您能告诉我如何生成base64编码的authconfig对象并使上面的curl命令工作吗

提前谢谢

Docker版本

Client version: 0.11.1
Client API version: 1.11
Go version (client): go1.2.1
Git commit (client): fb99f99
Server version: 0.11.1
Server API version: 1.11
Git commit (server): fb99f99
Go version (server): go1.2.1
我也有同样的问题

下面是您应该用来传递凭据的“原始”AuthConfig对象:

{ "username":"your_registry_username_or_email", "password":"*****", "auth":"", // leave empty "email":"your@email.tld" }

然后,只需将编码值传递到标头:

X-Registry-Auth: eyJ1c2VybmFtZSI6InlvdXJfcmVnaXN0cnlfdXNlcm5hbWVfb3JfZW1haWwiLCJwYXNzd29yZCI6IioqKioqIiwiYXV0aCI6IiIsImVtYWlsIjoieW91ckBlbWFpbC50bGQifQ==
下面是一个使用
curl

  • 可从r.getitlive.io获得的注册表
  • 在“192.168.60.10:8888”侦听的docker守护进程:
curl-X POST-d“”\ -H“X-Registry-Auth:EYJ1C2VYBMFtZSI6INLVDxJFCMVNAXN0CNLFDxNLCM5HBWVFB3JFZW1HawwilcwyxNZD29YZCI6IIOQKIOQIIWIYXV0ACI6IIISIMVTYWLSIJOIEW91CKBLBWFBC50BGQIFQ=”\ 'http://192.168.60.11:8888/images/create?fromImage=r.getitlive.io/cool/repo&tag=latest' 注意:通过将远程注册表端点/URL放入AuthConfig对象的
serveraddress
字段,我还无法使其正常工作。这就是为什么我要将注册表主机添加到
fromage=
参数中。

From,似乎
X-registry-Auth
头应该是表单的base-64编码json字符串

{
  'username': string,
  'password': string,
  'email': string,
  'serverddress' : string
}

谢谢您的帮助。我尝试了上面的curl命令。当我使用或registry.hub.docker.com/myname/myapp时,它表示无效的fromImage值(无效的名称空间名称(u),只允许[a-z0-9_u],大小介于4和30之间)。From image似乎不接受任何URL,但接受某种形式的myname/myapp,在这种情况下,它表示404,因为此存储库不是publicMmm。。。尝试完全删除注册表.hub.docker.com,因为这是默认设置。改为使用
?fromImage=myname/myapp
。这会给出一个404,因为不能识别对Dockerhub注册表的隐式提及
fromImage
确实接受注册表主机,但只接受自定义主机。出于某种原因,它拒绝了默认设置('index.docker.io'和我猜'registry.hub.docker.com'也是)。如果使用默认注册表,则必须完全删除主机部分。哦…,这些是不同组合的结果curl-X POST-d“-H”X-registry-Auth:xxxx=“''Error:{”status:“Pulling repository registry.hub.docker.com/myname/myapp”}{“errorDetail:{”message:“HTTP code:404”},“Error:“HTTP code:404”}Hi@alpha_cod,您是否使用docker Remote API成功地从私有注册表中提取图像?如果有人在此处登录,因为他们想使用
docker login
凭据通过API提取图像,我提出了一个问题: curl -X POST -d "" \ -H "X-Registry-Auth: eyJ1c2VybmFtZSI6InlvdXJfcmVnaXN0cnlfdXNlcm5hbWVfb3JfZW1haWwiLCJwYXNzd29yZCI6IioqKioqIiwiYXV0aCI6IiIsImVtYWlsIjoieW91ckBlbWFpbC50bGQifQ==" \ 'http://192.168.60.11:8888/images/create?fromImage=r.getitlive.io/cool/repo&tag=latest'
{
  'username': string,
  'password': string,
  'email': string,
  'serverddress' : string
}