You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docker --cloud build rejects every BuildKit-only flag (--secret, --ssh, --push, --output, ...) with unknown flag because the help check parses args against the legacy build command before the buildx alias runs.
Environment
docker CLI 29.9.0-rc.1 (first release with --cloud, docker/cli PR 7343)
Steps to reproduce
printf 'FROM alpine:3.20\nRUN --mount=type=secret,id=s cat /run/secrets/s\n' > Dockerfile
echo x > s
docker --cloud build --secret id=s,src=./s .
Same result for --ssh, --load, --output, --cache-to, --provenance, --sbom, --attest, --annotation, --push, --builder and --allow. Flags the legacy builder also had (--target, --no-cache, --platform, --build-arg, -q) work.
Expected
docker --cloud build accepts the same flags as docker build and docker --context docker-cloud build.
docker --cloud build without a BuildKit-only flag goes through buildx ("building with docker-cloud instance using docker driver").
Root cause
cmd/docker/cloud.go, cloudHelpRequest, decides whether the command is a help request before provisioning a sandbox. To do that it calls rootCmd.Find(args) and parses the remaining args against that command's flag set with flags.ParseAll. For build that is the built-in legacy docker build command, whose flag set has no --secret, --ssh, --push and so on. The parse error is returned through cli.FlagErrorFunc and the command aborts. The builder alias that rewrites build to buildx build runs later, in processAliases, so it never gets the chance.
Impact
Any CI recipe or script that uses docker --cloud build with build secrets, SSH forwarding, --push or --output is blocked at the first flag. The error message points at docker build --help, which lists --secret, so the user is told the flag exists and that it is unknown in the same breath.
Suggested fix
In docker/cli, either apply the builder alias before the help detection, or treat a command that will be aliased to a plugin the same way plugin commands are already treated in cloudHelpRequest (recognize only --help or -h immediately after the command name and skip flag parsing).
Activity
fix(cli): recognize build/bake/builder aliasing before cloud help check