buildx icon indicating copy to clipboard operation
buildx copied to clipboard

ls: no-trunc opt

Open crazy-max opened this issue 2 years ago • 2 comments

follow-up https://github.com/docker/buildx/pull/830 with the no-trunc opt.

When using ls, platforms can get wieldy easily and make output in the terminal difficult to read:

image

NAME/NODE              DRIVER/ENDPOINT                              STATUS    BUILDKIT                                PLATFORMS
builder                docker-container
 \_ builder0            \_ unix:///var/run/docker.sock              running   v0.12.3                                 linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
macos                  docker-container
 \_ macos0              \_ tcp://mac-mini-m1.home.fooooo.com:2376   error                                             linux/arm64*
sifive                 docker-container
 \_ sifive0             \_ tcp://192.168.0.65:2375                  running   v0.12.2                                 linux/riscv64*
default*               docker
 \_ default             \_ default                                  running   v0.11.7+d3e6c1360f6e                    linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
docker-test            docker
 \_ docker-test         \_ docker-test                              running   v0.11.6                                 linux/amd64, linux/386
docker20               docker
 \_ docker20            \_ docker20                                 running   v0.8+unknown                            linux/amd64, linux/386
docker23               docker
 \_ docker23            \_ docker23                                 running   v0.10.6+d52b2d5                         linux/amd64, linux/386
docker24               docker
 \_ docker24            \_ docker24                                 running   v0.11.6                                 linux/amd64, linux/386
docker24-arm64         docker
 \_ docker24-arm64      \_ docker24-arm64                           running   v0.11.7-0.20230525183624-798ad6b0ce9f   linux/arm64, linux/arm/v7, linux/arm/v6
remote-ssh             docker
 \_ remote-ssh          \_ remote-ssh                               running   v0.11.6+0a15675913b7                    linux/arm64, linux/arm/v7, linux/arm/v6

Only platforms are truncated by default and only when using the table format. We only display "major/common" platforms with a limitation to 4:

image

NAME/NODE              DRIVER/ENDPOINT                              STATUS    BUILDKIT                                PLATFORMS
builder                docker-container
 \_ builder0            \_ unix:///var/run/docker.sock              running   v0.12.3                                 linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, (+8)
macos                  docker-container
 \_ macos0              \_ tcp://mac-mini-m1.home.fooooo.com:2376   error                                             linux/arm64*
sifive                 docker-container
 \_ sifive0             \_ tcp://192.168.0.65:2375                  running   v0.12.2                                 linux/riscv64*
default*               docker
 \_ default             \_ default                                  running   v0.11.7+d3e6c1360f6e                    linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, (+8)
docker-test            docker
 \_ docker-test         \_ docker-test                              running   v0.11.6                                 linux/amd64, linux/386
docker20               docker
 \_ docker20            \_ docker20                                 running   v0.8+unknown                            linux/amd64, linux/386
docker23               docker
 \_ docker23            \_ docker23                                 running   v0.10.6+d52b2d5                         linux/amd64, linux/386
docker24               docker
 \_ docker24            \_ docker24                                 running   v0.11.6                                 linux/amd64, linux/386
docker24-arm64         docker
 \_ docker24-arm64      \_ docker24-arm64                           running   v0.11.7-0.20230525183624-798ad6b0ce9f   linux/arm64, linux/arm/v7, linux/arm/v6
remote-ssh             docker
 \_ remote-ssh          \_ remote-ssh                               running   v0.11.6+0a15675913b7                    linux/arm64, linux/arm/v7, linux/arm/v6

crazy-max avatar Nov 23 '23 14:11 crazy-max

I think a better output could be linux/arm64, linux/amd64 (N more)

:+1:

For the amd64 variants, I guess we could just show the maximum variant with truncated mode.

Hum so for linux/amd64, linux/amd64/v2, linux/amd64/v3 we should only display linux/amd64/v3 or linux/amd64, linux/amd64/v3? User might be confused if we just display max variant only. I guess this is similar to linux/arm and linux/arm/v7 :thinking:

crazy-max avatar Nov 30 '23 15:11 crazy-max

User might be confused if we just display max variant only.

If you think it is confusing, then I think better to not show variant at all in truncated view. We should not show linux/amd64/v1 or linux/amd64/v2 if that is not the max variant. The question is though if linux/amd64 (2 more) untruncated to linux/amd64 linux/amd64/v2 linux/amd64/v3` makes much sense.

tonistiigi avatar Nov 30 '23 19:11 tonistiigi

@tonistiigi Updated to take variants into account, see PR description.

crazy-max avatar Oct 03 '24 09:10 crazy-max