Docker Registry API Calls

Reference: https://docs.docker.com/registry/spec/api/

API Examples against a local, private registry:

List registry contents:

curl --insecure -X GET https://dockerregistry.sab.local:5000/v2/_catalog

Example:

[abruce@c05 ~]$ curl --insecure -X GET https://dockerregistry.sab.local:5000/v2/_catalog
{"repositories":["sab/aws-cli","sab/aws-helpers","sab/kubectl","sab/openshift-gnucobol"]}

List tags for registered images:

curl --insecure -X GET https://dockerregistry.sab.local:5000/v2/[image]/tags/list

Example:

[abruce@c05 ~]$ curl --noproxy '*' --insecure -X GET https://dockerregistry.sab.local:5000/v2/sab/kubectl/tags/list
{"name":"sab/kubectl","tags":["latest"]}

Get image details:

curl --insecure -X GET https://dockerregistry.sab.local:5000/v2/[image]/manifests/[TAG]

You get a multi-page output, as in:

[abruce@c05 ~]$ curl --noproxy '*' --insecure -X GET https://dockerregistry.sab.local:5000/v2/sab/kubectl/manifests/latest
{
"schemaVersion": 1,
"name": "sab/kubectl",
"tag": "latest",
"architecture": "amd64",
"fsLayers": [
{
"blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
},
{
"blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
},
{
"blobSum": "sha256:20614791291554281575c617229996e01d3d9777d59510ecd1cbe8362c426147"
},
{
"blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
b02ffe68c 33cb1642 6dc4496148
}
],
"history": [
{
"v1Compatibility": "{\"architecture\":\"amd64\",\"author\":\"Andrew Bruce \u003candrew.d.bruce@lmco.com\u003e\",\"config\":{\"Hostname\":\"1d811a9194c4\",\"Domainname\":\"\",\"User\":\"kubectl\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\",\"HOME=/config\"],\"Cmd\":null,\"ArgsEscaped\":true,\"Image\":\"sha256:c3945110bb811ed6414750ef8f9aa69d963ffceb8318b20d5911c8f0472c944f\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":[\"/usr/local/bin/kubectl\"],\"OnBuild\":[],\"Labels\":{}},\"container\":\"d58a124887ff371ffeb47f15c895e561cb99ca1746ba0118de48a51f6d97666f\",\"container_config\":{\"Hostname\":\"1d811a9194c4\",\"Domainname\":\"\",\"User\":\"kubectl\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin: /loc bin "v1Csr/bin:/sbin:/bin\",\"HOME=/config\"],\"Cmd\":[\"/bin/sh\",\"-c\",\"#(nop) ENTRYPOINT \u0026{[\\"/usr/local/bin/kubectl\\"]}\"],\"ArgsEscaped\":true,\"Image\":\"sha256:c3945110bb811ed6414750ef8f9aa69d963ffceb8318b20d5911c8f0472c944f\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":[\"/usr/local/bin/kubectl\"],\"OnBuild\":[],\"Labels\":{}},\"created\":\"2016-12-16T21:27:42.669572817Z\",\"docker_version\":\"1.10.3\",\"id\":\"f035e64b2d4a124f733c5459d81d3570bcce18b0c6ebc2856635db8b1b323a6e\",\"os\":\"linux\",\"parent\":\"e9a63762eeeba9481597518721010413150cfb524b3a399a6cdfc0e1022b57d4\",\"throwaway\":true}"
},
{
"v1Compatibility": "{\"id\":\"e9a63762eeeba9481597518721010413150cfb524b3a399a6cdfc0e1022b57d4\",\"parent\":\"3e12474a03f1f43d8eec52de64c42cc13b1986d0a7d5310dc487306dbef04285\",\"created\":\"2016-12-16T21:27:37.727054546Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop) USER [kubectl]\"]},\"author\":\"Andrew Bruce \u003candrew.d.bruce@lmco.com\u003e\",\"throwaway\":true}"
}, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, } "v1Compati ": }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, }, the image from the registry.

Delete an image:
Example:

isgmj2chg3qp:~ n75029$ curl --noproxy '*' --insecure -X DELETE 'https://dockerregistry.sab.local:5000/v2/ubuntu/manifests/sha256:1da3f5cfcf5cff9059d335d7dcc20944aaeb3d56370d35e1f66a21c18b6f591b'

Note that you get no output. But subsequent calls to view the registry show the image is no longer there:

isgmj2chg3qp:~ n75029$ curl --noproxy '*' --insecure -X GET https://dockerregistry.sab.local:5000/v2/ubuntu/manifests/latest
{"errors":[{"code":"MANIFEST_UNKNOWN","message":"manifest unknown","detail":{"Name":"ubuntu","Revision":"sha256:1da3f5cfcf5cff9059d335d7dcc20944aaeb3d56370d35e1f66a21c18b6f591b"}}]}

Team-oriented systems mentor with deep knowledge of numerous software methodologies, technologies, languages, and operating systems. Excited about turning emerging technology into working production-ready systems. Focused on moving software teams to a higher level of world-class application development. Specialties:Software analysis and development...Product management through the entire lifecycle...Discrete product integration specialist!

Tagged with:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.