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

"docker buildx ls --format json" lists each entry twice #2969

Closed
3 tasks done
wolfch-elsevier opened this issue Feb 6, 2025 · 4 comments · Fixed by #2970
Closed
3 tasks done

"docker buildx ls --format json" lists each entry twice #2969

wolfch-elsevier opened this issue Feb 6, 2025 · 4 comments · Fixed by #2970
Labels
area/builder kind/bug Something isn't working

Comments

@wolfch-elsevier
Copy link

wolfch-elsevier commented Feb 6, 2025

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

  • docker buildx ls --format json lists each entry twice whereas docker buildx ls works properly

Expected behaviour

The count of builders listed when running "docker buildx ls" (table format, default) vs. "docker buildx ls --format json" should be the same. For example, running "docker buildx ls", I get:

$ docker buildx ls
NAME/NODE           DRIVER/ENDPOINT     STATUS    BUILDKIT   PLATFORMS
default             docker
 \_ default          \_ default         running   v0.17.3    linux/amd64 (+3), linux/arm64, linux/arm (+2), linux/ppc64le, (2 more)
desktop-linux*      docker
 \_ desktop-linux    \_ desktop-linux   running   v0.17.3    linux/amd64 (+3), linux/arm64, linux/arm (+2), linux/ppc64le, (2 more)

...then when running, "docker buildx ls --format json", I should see the same two builders in JSON-line format (each entry truncated with ellipsis for brevity):

{"Name":"default","Driver":"docker", ...}
{"Name":"desktop-linux","Driver":"docker", ...}

Actual behaviour

...instead, I see the entries are doubled (each entry truncated with ellipsis for brevity):

{"Name":"default","Driver":"docker", ...}
{"Name":"default","Driver":"docker", ...}
{"Name":"desktop-linux","Driver":"docker", ...}
{"Name":"desktop-linux","Driver":"docker", ...}

The full output result of docker buildx ls --format json is attached:
buildx_ls_out.json

Buildx version

github.com/docker/buildx v0.19.2-desktop.1 412cbb151f1be3f8a94dc4eb03cd1b67f261dec5

Docker info

Client:
 Version:    27.4.0
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  ai: Ask Gordon - Docker Agent (Docker Inc.)
    Version:  v0.5.1
    Path:     /Users/wolf2/.docker/cli-plugins/docker-ai
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.19.2-desktop.1
    Path:     /Users/wolf2/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.31.0-desktop.2
    Path:     /Users/wolf2/.docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.37
    Path:     /Users/wolf2/.docker/cli-plugins/docker-debug
  desktop: Docker Desktop commands (Beta) (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/wolf2/.docker/cli-plugins/docker-desktop
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     /Users/wolf2/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.27
    Path:     /Users/wolf2/.docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.5
    Path:     /Users/wolf2/.docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     /Users/wolf2/.docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/wolf2/.docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.15.1
    Path:     /Users/wolf2/.docker/cli-plugins/docker-scout

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 2
 Server Version: 27.4.0
 Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 472731909fa34bd7bc9c087e4c27943f9835f111
 runc version: v1.1.13-0-g58aa920
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 6.10.14-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 7.655GiB
 Name: docker-desktop
 ID: a9d33cb0-17b0-4031-9f64-34b0bd1774f3
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Labels:
  com.docker.desktop.address=unix:///Users/wolf2/Library/Containers/com.docker.docker/Data/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: daemon is not using the default seccomp profile

Builders list

NAME/NODE           DRIVER/ENDPOINT     STATUS    BUILDKIT   PLATFORMS
default             docker
 \_ default          \_ default         running   v0.17.3    linux/amd64 (+3), linux/arm64, linux/arm (+2), linux/ppc64le, (2 more)
desktop-linux*      docker
 \_ desktop-linux    \_ desktop-linux   running   v0.17.3    linux/amd64 (+3), linux/arm64, linux/arm (+2), linux/ppc64le, (2 more)

Configuration

mininal_dockerfile.txt:

FROM scratch
$ docker buildx build --progress plain -f mininal_dockerfile.txt .
#0 building with "desktop-linux" instance using docker driver

#1 [internal] load build definition from mininal_dockerfile.txt
#1 transferring dockerfile: 62B done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 transferring context: 98B done
#2 DONE 0.0s

#3 exporting to image
#3 exporting layers done
#3 exporting manifest sha256:3a58ad119f0dae830e39299dd9d94100e3a764665fba8810f9a873d3ac716aec done
#3 exporting config sha256:471a1b8817eefb6569017c1a76f288e0d4e5c8476eb199485c469d0b033168bf done
#3 naming to moby-dangling@sha256:3a58ad119f0dae830e39299dd9d94100e3a764665fba8810f9a873d3ac716aec done
#3 DONE 0.0s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/b814b21gpa45p9hto49guhayn

Build logs

N/A - not a build issue

Additional info

I searched if this was already reported, but didn't find anything, or I didn't search properly.

@crazy-max
Copy link
Member

This is expected, output is in JSON Lines format similar to other docker commands like docker context ls --format json.

@wolfch-elsevier
Copy link
Author

wolfch-elsevier commented Feb 6, 2025

This is expected, output is in JSON Lines format similar to other docker commands like docker context ls --format json.

Ok, that explains array-vs-json-lines; I edited this ticket to just be about the duplicate entries issue.

@wolfch-elsevier wolfch-elsevier changed the title "docker buildx ls --format json" generates invalid JSON and lists each entry twice "docker buildx ls --format json" lists each entry twice Feb 6, 2025
@wolfch-elsevier
Copy link
Author

This is expected, output is in JSON Lines format similar to other docker commands like docker context ls --format json.

...also, maybe the https://github.com/docker/buildx/blob/master/docs/reference/buildx_ls.md page should mention the output is in JSON Lines format format.

@crazy-max
Copy link
Member

about the duplicate entries issue.

Hum yeah you should not have duplicated entries, let me check this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/builder kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants