-
Notifications
You must be signed in to change notification settings - Fork 617
imagetools inspect: add --format flag #854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
814ee07 to
d5a04b3
Compare
util/imagetools/inspect.go
Outdated
| // needs to discard containerd logger otherwise it will print | ||
| // unnecessary info during image reference resolution like | ||
| // https://github.com/containerd/containerd/blob/1a88cf5242445657258e0c744def5017d7cfb492/remotes/docker/resolver.go#L288 | ||
| ctx = bxctx.WithLoggerDiscarded(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to discard containerd logger otherwise it will print unnecessary info during image reference resolution:
$ docker buildx imagetools inspect alpinefoo
INFO[0001] trying next host error="pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed" host=registry-1.docker.io
error: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failednow:
$ docker buildx imagetools inspect alpinefoo
error: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization faileda210432 to
09894eb
Compare
|
In addition, wondering if we could add another flag to display buildinfo from a metadata file ( |
|
@crazy-max Thanks for this! What's the typical release cadence for |
1330560 to
90f7d4b
Compare
|
@tonistiigi As discussed,
The About buildx, there will be a patch release on wednesday (0.7.1) to fix the current issues. This PR will probably be available in the next minor release but you can already download the artifacts in staging from the GitHub workflow if you want to try it. |
|
I'd expect the template format like other commands. Eg. |
commands/imagetools/inspect.go
Outdated
|
|
||
| flags := cmd.Flags() | ||
| flags.BoolVar(&options.raw, "raw", false, "Show original JSON manifest") | ||
| flags.StringVar(&options.format, "format", "manifest", "Format the output") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| flags.StringVar(&options.format, "format", "manifest", "Format the output") | |
| flags.StringVar(&options.format, "format", "manifest", "Format the output (\"manifest\", or \"buildinfo\")") |
Agree but then |
|
|
|
Ok so |
90f7d4b to
0537928
Compare
|
For Is the config taking the first item from the index atm? |
|
Sorry didn't see your comment!
Ok sgtm
Atm I don't handle config, only buildinfo and manifest. |
b4b65de to
b1019c7
Compare
b1019c7 to
0a28e6d
Compare
tonistiigi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
» docker buildx imagetools inspect --raw alpine
error: format and raw cannot be used together
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For multi-platform this breaks:
docker buildx imagetools inspect mysql
error: no match for platform in manifest sha256:0962b771c2398c6dcddbbe77b3cf6658408396229b612035d938fb7c8d11c23c: not found
Should also make sure that without format we don't make these requests at all.
|
As a follow-up, looks like some pkg reorganization is needed as these functions definitely should not require importing |
cbc8508 to
addb396
Compare
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
addb396 to
f8ae387
Compare
|
|
||
| * `.Name`: provides the reference of the image | ||
| * `.Manifest`: provides manifest or manifest list | ||
| * `.Image`: provides the image config as `application/vnd.oci.image.config.v1+json` mediatype |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this "as mediatype" mean? I expect it is just the full config as it is in registry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's it I will remove that. Was taken from https://github.com/opencontainers/image-spec/blob/1f308fd27264a52f6a089202b1ff9dc15ff27398/specs-go/v1/config.go#L81
f8ae387 to
5f807b9
Compare
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
5f807b9 to
20a55e9
Compare
follow-up docker/roadmap#243 (comment)
adds
--formatflag toimagetools inspectcommand. Currently supported values aremanifest(default and current behavior) andbuildinfo.buildinfois the new one to retrieve build information for an image in the registry.cc @JamieMagee
Signed-off-by: CrazyMax crazy-max@users.noreply.github.com