-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
TL;DR;
Add the ability to pull down an image JSON from a registry w/o the need to download all layers.
This is trying to carry moby/moby#14257 and moby/moby#14258. The latter was closed since docker inspect should not interact with registries.
docker/distribution/cmd/inspect
What I'm thinking should be pretty simple to implement (I hope) but I decided to write down this proposal to gather feedback instead of going straight to the code.
I agree adding the notion of remote to docker inspect is not doable (since just a small subset of docker commands deal with remotes and docker doesn't want to couple other commands to remotes). Adding an option to shallow pull an image could be good but that's definitely much work for something, IMO, easy like pulling a manifest and format it.
The main use case we are looking for with this is the ability to verify an image is up date.
The common use case is to be able to download and examine one or more image JSON files from the registry to discover which images you want to pull.
Our goal it to look at the LABEL data associated with images. Examples may include, show me all of the images based on rhel7, show me all of the images with this license field and so on. I'm sure others may have other use cases I failed to list here now.
In the docker issues mentioned above, a proposal was to have an external tool that can inspect a remote registry.
I was thinking if an external command could be added under docker/distribution/cmd/.
I'd call it inspect and its work should be just to inspect images on registries returning the JSON associated with the given image.
$ inspect docker.io/fedora
[
{
"Id": "ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
"Parent": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
...
"Os": "linux",
"Size": 186515831
}
]
$ inspect ubuntu
LOG: using official docker.io registry
[
{
"Id": "ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
"Parent": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
...
"Os": "linux",
"Size": 186515831
}
]
[...]
@stevvooe I noticed you were pretty active on having something like this, I'd love to hear something from you
@aaronlehmann @tonistiigi what do you guys think?