ls: dedup instances from store and context by crazy-max · Pull Request #1131 · docker/buildx (original) (raw)

$ docker context create foo
foo
Successfully created context "foo"
$ docker buildx create --name foo
foo
$ docker buildx ls
NAME/NODE        DRIVER/ENDPOINT                        STATUS                 PLATFORMS
builder2 *       docker-container
  builder20      unix:///var/run/docker.sock            running                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
foo              docker-container
  foo0           unix:///var/run/docker.sock            inactive
desktop-linux                                           protocol not available
desktop-windows                                         protocol not available
foo              docker
  foo            foo                                    running                linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
default          docker
  default        default                                running                linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6

do not add a context builder to the list if one from the store with the same name exists. An instance from the store takes precedence over context builders so don't think we should display both of them:

$ docker buildx ls
NAME/NODE        DRIVER/ENDPOINT                        STATUS                 BUILDKIT PLATFORMS
builder2 *       docker-container
  builder20      unix:///var/run/docker.sock            running                394ccf8  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
foo              docker-container
  foo0           unix:///var/run/docker.sock            inactive
default          docker
  default        default                                running                20.10.14 linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6        
desktop-linux                                           protocol not available
desktop-windows                                         protocol not available