docker / buildx

Docker CLI plugin for extended build capabilities with BuildKit
Apache License 2.0
3.33k stars 448 forks source link

`buildx ls`: don't emit warnings when no connection #2107

Open nicks opened 8 months ago

nicks commented 8 months ago

Description

Repro steps:

  1. Install TestContainers Desktop
  2. Turn off TestContainers Desktop when not being used
  3. Run docker buildx ls

Expected Behavior

buildx should treat the tcd builder as inactive

Actual Behavior

buildx prints ugly warnings about tcd not running

docker buildx ls
NAME/NODE           DRIVER/ENDPOINT                      STATUS   BUILDKIT             PLATFORMS           
default             docker                                                             
  default           default                              running  v0.11.7+d3e6c1360f6e linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
tcd                                                      error                         

Cannot load builder tcd: Cannot connect to the Docker daemon at tcp://127.0.0.1:34039. Is the docker daemon running?

Additional info

Note that docker context ls has the expected behavior

docker context ls
NAME                TYPE                DESCRIPTION                               DOCKER ENDPOINT                                 KUBERNETES ENDPOINT   ORCHESTRATOR
default *           moby                Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                                                                
tcd                 moby                Testcontainers Desktop                    tcp://127.0.0.1:34039

No warnings printed

this comes up a lot when i'm using remote daemons for random things.

tonistiigi commented 8 months ago

I believe the difference is that context ls does not actually connect to any of the endpoints. The error column there seems to be just the endpoint parsing error column. Most fields in buildx ls come from the established connection. If you don't see the error then you don't know how to fix the issue.