Docker API图像创建/拉动(/v1.6/images/create)显然总是返回
HTTP/1.1 200 OK
Content-Type: application/json
Run Code Online (Sandbox Code Playgroud)
无论过程是成功还是失败.
此外,有效载荷无效json.
例如:/v1.6/images/create?fromImage = whatevertheflush
收益:
{"status":"Pulling repository whatevertheflush"}{"error":"Server error: 404 trying to fetch remote history for whatevertheflush","errorDetail":{"code":404,"message":"Server error: 404 trying to fetch remote history for whatevertheflush"}}
Run Code Online (Sandbox Code Playgroud)
不是有效的json,并且没有转发/使用HTTP错误使得处理客户端错误变得很麻烦.
实际上,docker-py只是呕吐有效载荷(https://github.com/dotcloud/docker-py/blob/master/docker/client.py#L374).来自openstack的DockerHTTPClient尝试根据http错误代码返回一个值,该代码总是200 ...(https://github.com/openstack/nova/blob/master/nova/virt/docker/client.py# L191)
现在,我理解拉动可能需要很长时间,并且开始向客户端传输答案有点有意义,但我不禁想到这里有问题.
所以,这有三个方面:
docker ×1