-
Notifications
You must be signed in to change notification settings - Fork 482
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
imagetools inspect --format
ignores formatting unless json
is used
#1175
Comments
/cc @crazy-max @jedevc |
@thaJeztah Since docker/cli#2936 has been merged I will revisit the format output to be aligned. |
Thanks! Yeah, I was mostly surprised it was silently ignored 😅. w.r.t. the newline at the end; technically it's "correct" (the newline doesn't have to be there (also not when using it for scripting), but ISTR the newline was added to make it slightly easier to use interactively. |
Hey! It looks like this issue is coming up on a year old, is this fixable now given the aforementioned PR was merged? I still see this behaviour today. ❯ docker buildx imagetools inspect debian:bullseye --format="{{.Manifest.Digest}}"
Name: docker.io/library/debian:bullseye
MediaType: application/vnd.docker.distribution.manifest.list.v2+json
Digest: sha256:1e5f2d70c9441c971607727f56d0776fb9eecf23cd37b595b26db7a974b2301d
Manifests:
... |
The linked PR was implementing changes in the docker CLI itself; this probably hasn't been worked on for buildx. Contributions welcome though if someone is interested working on this. |
Sure, I'm taking a look now. There's definitely something funky going on given it doesn't seem that Go templates for |
Cool, I removed that logic and it seems to work as expected. I'll clean it up and submit a PR. ❯ go run ./cmd/buildx imagetools inspect --format="{{.Manifest.Digest}}" alpine
sha256:02bb6f428431fbc2809c5d1b41eab5a68350194fb508869a33cb1af4444c9b11 |
Use the formatting packages provided by docker/cli to comply with the official formatting documentation. https://docs.docker.com/config/formatting/ The use of the official formatting packages also fixes the format templating. Fixes: docker#1175
Use the formatting packages provided by docker/cli to comply with the official formatting documentation. https://docs.docker.com/config/formatting/ The use of the official formatting packages also fixes the format templating. Fixes: docker#1175 Signed-off-by: Thomas Way <thomas@6f.io>
Use the formatting packages provided by docker/cli to comply with the official formatting documentation. https://docs.docker.com/config/formatting/ The use of the official formatting packages also fixes the format templating. Fixes: docker#1175 Signed-off-by: Thomas Way <thomas@6f.io>
Was writing a reply to docker/hub-feedback#2043, and noticed this.
Reproduced on;
When using the
-f
/--format
option, the template is ignored, unless it's using thejson
function;docker buildx imagetools inspect --format '{{.Manifest.Digest}}' tensorflow/tensorflow:1.13.1-gpu-py3 Name: docker.io/tensorflow/tensorflow:1.13.1-gpu-py3 MediaType: application/vnd.docker.distribution.manifest.v2+json Digest: sha256:0f949ccc690d9c50e9b46b16d9030c2c6845af621c2e7e82c4bf59803edc69b5
This is inconsistent with other commands, for example, here's
docker image inspect
(difference between usingjson
and without is that thejson
output uses JSON quoting for the output);Also note that the
json
output does not print a newline at the end, which can make it a bit cumbersome to use; here's the full output (notice that the prompt is appended to the output, because there's no trailing newline)The text was updated successfully, but these errors were encountered: