Skip to content
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

Add a --quiet --no-trunc option to docker buildx ls #380

Closed
gabrieldemarmiesse opened this issue Sep 4, 2020 · 5 comments · May be fixed by #830
Closed

Add a --quiet --no-trunc option to docker buildx ls #380

gabrieldemarmiesse opened this issue Sep 4, 2020 · 5 comments · May be fixed by #830
Labels
kind/enhancement New feature or request

Comments

@gabrieldemarmiesse
Copy link

Hello, I'm making a python lib that wraps the docker CLI commands (similar to docker-py, but I use the cli binary, so it's possible to use buildx for example, unlike docker-py).

When writing the lib, I noticed that it was harder to work with docker buildx than with "docker container" or "docker volume", or "docker network". This is because the output is much different. Especially, what's interesting to me is the "--quiet" option which is available in "docker container ls" or "docker image ls". Without it, I have to do some complicated parsing and it's quite a pain.

As an example:

$ docker image ls --quiet --no-trunc
sha256:884ad2927daef99a5df55f19a1879a56b7c0de57962198918b14fd59e0f5501f
sha256:9999ebee41a37c1b721a55c4194e478985f3ec71345aa1a4d176b2a2caff652a
sha256:a29000ba32ad94cc954a598800cc19382abf5bd2e4eb9efb452ac25800aa85ea
sha256:e857357de1d3f939650d88affb23b0a7dede15a9655ff28b76b68d23906b1dc0
sha256:7682a46a212a122c13610420de3f101121f7ec697b349a8356894e4461bf50bd
sha256:16470a424dfdef1ae9031d2fe597641600d723f1d6e66b5956fab02c0377c44b
sha256:7e7796b33525a31280bb107287e131784dfbcdccbad5f233e0c86b9d7075f0d3
sha256:66f5db10c13450e1125b95ad25fb5e59f15a8c499cf14b3dc1b8c6997090a1e4
sha256:8ac321c02ca4295664a66d031728257409619d6f15a90edccf3e4243f1961ddd
sha256:be039c2175a7241a8eb4d70ac2bc5f174c7c3bb2851bc38f5eaa184d525a2db8
sha256:0f19d1eb075a91a9797694640824d5012c5fb24cc2cf479153bc3d2861758a33
sha256:5d6bfa2e7743dae8f01c43c70c734fa7e910d6ec69fddb01625fdcaf6fa0235
$ docker network ls --quiet --no-trunc
dcc3a6eb9f6f1cbca25c7c11b986ba837dc3438facf8dd60632e64fff6e673f5
ffb3f184cd0a2077f75a507320a9613eec135dc6cb234340ea924d576215e96e
1d41d84573897ba7df0dc8fd48bc142d7673362bd8bee870e7bf4f0989b6883d
e22930c1044733530f41ad70df4731b68f196d398064d0a93f7d41e89b2c747e
$ docker buildx ls
NAME/NODE                DRIVER/ENDPOINT             STATUS   PLATFORMS
blissful_swartz          docker-container
  blissful_swartz0       unix:///var/run/docker.sock inactive
charming_chebyshev       docker-container
  charming_chebyshev0    unix:///var/run/docker.sock inactive
charming_visvesvaraya    docker-container
  charming_visvesvaraya0 unix:///var/run/docker.sock inactive
vigorous_bell            docker-container
  vigorous_bell0         unix:///var/run/docker.sock inactive
default *                docker
  default                default                     running  linux/amd64, linux/386

Which is much harder to parse for a third party lib.

@tonistiigi
Copy link
Member

Would --format '{{json .}}' be sufficient?

@gabrieldemarmiesse
Copy link
Author

Yes :)

@tonistiigi tonistiigi added the kind/enhancement New feature or request label Jan 29, 2021
@tonistiigi
Copy link
Member

Feel free to create PRs for --format flags for commands where you need them. I don't see an issue with supporting them.

@gabrieldemarmiesse
Copy link
Author

I'm not a go programmer, but I'll try to take a look

@crazy-max
Copy link
Member

Fixed in #1787, see https://github.com/docker/buildx/blob/master/docs/reference/buildx_ls.md#-format-the-output---format

For no-trunc, this is not directly related to your use case but started something in #2138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants