Tương tự như câu hỏi "What´s the sha256 code of a docker image?", tôi muốn tìm thông báo về hình ảnh Docker. Tôi có thể thấy tiêu hóa khi tôi tải một hình ảnh:Tôi có thể nhận được thông báo hình ảnh mà không cần tải xuống hình ảnh không?
$ docker pull waisbrot/wait:latest
latest: Pulling from waisbrot/wait
Digest: sha256:6f2185daa4ab1711181c30d03f565508e8e978ebd0f263030e7de98deee5f330
Status: Image is up to date for waisbrot/wait:latest
$
Một câu hỏi, What is the Docker registry v2 API endpoint to get the digest for an image có một câu trả lời gợi ý các Docker-Content-Digest
tiêu đề.
tôi có thể thấy rằng có một tiêu đề Docker-Content-Digest
khi tôi lấy manifest cho hình ảnh:
$ curl 'https://auth.docker.io/token?service=registry.docker.io&scope=repository:waisbrot/wait:pull' -H "Authorization: Basic ${username_password_base64}"
# store the resulting token in DT
$ curl -v https://registry-1.docker.io/v2/waisbrot/wait/manifests/latest -H "Authorization: Bearer $DT" -XHEAD
* Trying 52.7.141.30...
* Connected to registry-1.docker.io (52.7.141.30) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.docker.io
* Server certificate: RapidSSL SHA256 CA - G3
* Server certificate: GeoTrust Global CA
> GET /v2/waisbrot/wait/manifests/latest HTTP/1.1
> Host: registry-1.docker.io
> User-Agent: curl/7.43.0
> Accept: */*
> Authorization: Bearer LtVRw-etc-etc-etc
>
< HTTP/1.1 200 OK
< Content-Length: 4974
< Content-Type: application/vnd.docker.distribution.manifest.v1+prettyjws
< Docker-Content-Digest: sha256:128c6e3534b842a2eec139999b8ce8aa9a2af9907e2b9269550809d18cd832a3
< Docker-Distribution-Api-Version: registry/2.0
< Etag: "sha256:128c6e3534b842a2eec139999b8ce8aa9a2af9907e2b9269550809d18cd832a3"
< Date: Wed, 07 Sep 2016 16:37:15 GMT
< Strict-Transport-Security: max-age=31536000
Tuy nhiên, tiêu đề này là không giống nhau. Lệnh pull
đã cho tôi số 6f21
và tiêu đề hiển thị 128c
. Hơn nữa, lệnh kéo không làm việc cho rằng tiêu hóa:
$ docker pull waisbrot/[email protected]:128c6e3534b842a2eec139999b8ce8aa9a2af9907e2b9269550809d18cd832a3
Error response from daemon: manifest unknown: manifest unknown
trong khi mọi thứ làm việc như tôi muốn khi tôi có đúng tiêu hóa:
$ docker pull waisbrot/[email protected]:6f2185daa4ab1711181c30d03f565508e8e978ebd0f263030e7de98deee5f330 12:46 [email protected]
sha256:6f2185daa4ab1711181c30d03f565508e8e978ebd0f263030e7de98deee5f330: Pulling from waisbrot/wait
Digest: sha256:6f2185daa4ab1711181c30d03f565508e8e978ebd0f263030e7de98deee5f330
Status: Image is up to date for waisbrot/[email protected]:6f2185daa4ab1711181c30d03f565508e8e978ebd0f263030e7de98deee5f330
Những gì tôi đang tìm kiếm một cách để là dịch thẻ latest
(thay đổi mọi lúc) thành thông báo cố định mà tôi có thể kéo đáng tin cậy. Nhưng tôi không muốn thực sự kéo nó xuống để làm bản dịch này.
Whoah, tôi đã không mong đợi một giải pháp dễ dàng như vậy! Có, đó dường như là câu trả lời: khi tôi thêm tiêu đề đó, tiêu đề tiêu hóa tôi nhận được là tiêu đề tôi đang tìm kiếm. –