docker / docker/cli

Tab-completion for `docker build` is partially broken

Open
#5,517 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/builder area/completion area/ux kind/bug
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

When trying tab-completion for docker build, it looks like it's trying to complete subcommands (this should probably complete to file-paths / directory names);

docker build<TAB>
build    builder  buildx

Trying to provide completion for a flag that has completion set locally does complete, but does not use buildx's completion;

docker build --platform<TAB>
linux           linux/amd64     linux/arm/v5    linux/arm/v7    linux/arm64/v8  linux/riscv64   wasip1          windows
linux/386       linux/arm       linux/arm/v6    linux/arm64     linux/ppc64le   linux/s390x     wasip1/wasm     windows/amd64

Completion for docker buildx build uses local files (which would be expected for the build-context), and forcing it to complete options (--<tab>) works;

docker buildx build --<TAB>
--add-host         (Add a custom host-to-IP mapping (format: "host:ip"))
--allow            (Allow extra privileged entitlement (e.g., "network.host", "security.insecure"))
--annotation       (Add annotation to the image)
--attest           (Attestation parameters (format: "type=sbom,generator=image"))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the completion cases for docker build and docker buildx build, then inspect the completion implementation and related pull request #5516. Compare subcommand, build-context, flag, and flag-value completion; done means docker build completes paths or directories and its flags and values behave consistently with buildx build.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.