如何解决Docker Registry V2 API-推送图像-上传PATCH失败,出现404
我正在尝试使用Docker Http V2 API在此链接后推送图像; https://docs.docker.com/registry/spec/api/#pushing-an-image;在POST到/ blob / uploads之后,我可以获取“ Location”标头值,但是块/单片上载不起作用-找不到404-即使我设置了必需的标头。
String url = String.format("https://%s/v2/%s/blobs/uploads/",dockerRegistry,repository);
Mono<ClientResponse> clientResponse = WebClient.create(url).post().header("Connection","close").exchange();
ClientResponse clientResponse2 = clientResponse.block();
HttpHeaders asHttpHeaders = clientResponse2.headers().asHttpHeaders();
String location = asHttpHeaders.get("Location").get(0);
String uploadUrl = ("https://" + dockerRegistry + location);
Mono<ClientResponse> clientResponse3 =
WebClient.create(uploadUrl).patch().contentLength(bytes.length)
.header("Content-Range","0-" + Integer.toString(bytes.length - 1))
.contentType(MediaType.APPLICATION_OCTET_STREAM).header("Connection","close")
.bodyValue(bytes).exchange()
.timeout(Duration.ofHours(1));
ClientResponse clientResponse4 = clientResponse3.block(); // 404 NOT FOUND
HttpHeaders asHttpHeaders = clientResponse4.headers().asHttpHeaders();
return asHttpHeaders.get("Location").get(0);
我在这里看不到有太多失败的余地,但是我仍然遇到错误。有人可以帮我吗? Bw,我正在尝试在此处连接到Azure容器注册表。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。