docker / buildx

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

No error messages on unknown command #2738

Closed rumpl closed 1 month ago

rumpl commented 1 month ago

Contributing guidelines

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

Description

When I try to run a buildx command that doesn't exist, it doesn't show any errors about an unknown command, it only shows the help:

; docker buildx asdfasdf

Usage:  docker buildx [OPTIONS] COMMAND

Extended build capabilities with BuildKit

Options:
      --builder string   Override the configured builder instance

Management Commands:
  imagetools  Commands to work on images in registry

Commands:
  bake        Build from a file
  build       Start a build
  create      Create a new builder instance
  du          Disk usage
  inspect     Inspect current builder instance
  ls          List builder instances
  prune       Remove build cache
  rm          Remove a builder instance
  stop        Stop builder instance
  use         Set the current builder instance
  version     Show buildx version information

Run 'docker buildx COMMAND --help' for more information on a command.

Expected behaviour

buildx should tell me that the command doesn't exist

Actual behaviour

buildx only shows the help

Buildx version

github.com/docker/buildx v0.12.0-desktop.1 e20af6f1656e774f14fdb47befca9f12b33d1257

Docker info

; docker info Client: Version: 27.3.1 Context: desktop-linux Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.12.0-desktop.1 Path: /Users/rumpl/.pinata/downloads/docker-plugins/v0.12.0-desktop.1/docker-buildx compose: Docker Compose (Docker Inc.) Version: v2.29.7 Path: /Users/rumpl/.docker/cli-plugins/docker-compose debug: Get a shell into any image or container (Docker Inc.) Version: 0.0.37 Path: /Users/rumpl/.docker/cli-plugins/docker-debug desktop: Docker Desktop commands (Alpha) (Docker Inc.) Version: v0.0.15 Path: /Users/rumpl/.docker/cli-plugins/docker-desktop dev: Docker Dev Environments (Docker Inc.) Version: v0.1.2 Path: /Users/rumpl/.docker/cli-plugins/docker-dev extension: Manages Docker extensions (Docker Inc.) Version: v0.2.27 Path: /Users/rumpl/.docker/cli-plugins/docker-extension feedback: Provide feedback, right in your terminal! (Docker Inc.) Version: v1.0.5 Path: /Users/rumpl/.docker/cli-plugins/docker-feedback harmonia: Extend your localhost with cloud workspaces (Docker Inc.) Version: 0.13.135 Path: /Users/rumpl/.docker/cli-plugins/docker-harmonia init: Creates Docker-related starter files for your project (Docker Inc.) Version: v1.3.0 Path: /Users/rumpl/.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/rumpl/.docker/cli-plugins/docker-sbom scout: Docker Scout (Docker Inc.) Version: v1.8.0 Path: /Users/rumpl/plugins/docker-scout

Server: Containers: 2 Running: 2 Paused: 0 Stopped: 0 Images: 10 Server Version: 27.3.1 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Using metacopy: false Native Overlay Diff: true userxattr: false 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 Swarm: inactive Runtimes: runc io.containerd.runc.v2 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.11-linuxkit Operating System: Docker Desktop OSType: linux Architecture: aarch64 CPUs: 10 Total Memory: 7.654GiB Name: docker-desktop ID: 12d95ad9-fffd-4ce1-81a3-2bc163d97a3d 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/rumpl/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

Not sure this is useful

Configuration

No need for a dockerfile

Build logs

No response

Additional info

No response

crazy-max commented 1 month ago

Seems err is nil in https://github.com/docker/buildx/blob/1de332530f6c21e69ddf8577fbc7adcf0ae7c723/cmd/buildx/main.go#L88

I'm looking at it

tonistiigi commented 1 month ago

Btw, this is same for docker cli

» docker image foobar                                                                                                                                                               !7878

Usage:  docker image COMMAND

Manage images

Commands:
  build       Build an image from a Dockerfile
  history     Show the history of an image
  import      Import the contents from a tarball to create a filesystem image
  inspect     Display detailed information on one or more images
  load        Load an image from a tar archive or STDIN
  ls          List images
  prune       Remove unused images
  pull        Download an image from a registry
  push        Upload an image to a registry
  rm          Remove one or more images
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

Run 'docker image COMMAND --help' for more information on a command.
thaJeztah commented 1 month ago

Related (cli, but not shipped yet);

dvdksn commented 1 month ago

also related;