ERROR: docker: 'docker buildx build' requires 1 argument after a
docker build means the command had nothing at the end where the usage line
expects PATH | URL | -. In the test the dot was left off
docker build -t fix12-dkbuild-a. Add the folder to build from, here
., as the last argument.
docker build --progress=plain -t fix12-dkbuild-a . in the same folder built
the image and ended with exit code 0. The message names docker buildx build
although the command typed was docker build, and its usage line reads
Usage: docker buildx build [OPTIONS] PATH | URL | -.
The error
docker build -t fix12-dkbuild-a 2>&1
ERROR: docker: 'docker buildx build' requires 1 argument
Usage: docker buildx build [OPTIONS] PATH | URL | -
Run 'docker buildx build --help' for more information
exit=1
Why it happens
The usage line spells out what the command wants: options first, then one
PATH, URL or -. The -t fix12-dkbuild-a
pair is an option with its value, so after it there was nothing left in that place, and the
command stopped before any build step ran: the output has no #1 line at all.
The dot is easy to lose. It is one character at the end of the line, it looks like
punctuation in a tutorial, and a command copied out of a sentence can lose it. The
message reads as if the problem were buildx, but the same client built the
image as soon as the dot was back.
The fix
docker build --progress=plain -t fix12-dkbuild-a . 2>&1
#0 building with "desktop-linux" instance using docker driver
...
#7 naming to docker.io/library/fix12-dkbuild-a:latest done
#7 unpacking to docker.io/library/fix12-dkbuild-a:latest
#7 unpacking to docker.io/library/fix12-dkbuild-a:latest 0.1s done
#7 DONE 0.3s
exit=0
The change that matters is the . at the end; --progress=plain
was added so the build steps print as plain lines. Another folder in place of the dot was
not tried here.
How it was reproduced
A two-stage Dockerfile on alpine:latest (image id 294b683cb724, cached, as
docker images alpine printed) in a scratch folder, built on Docker Desktop
4.99.0 for Windows with client and engine 29.9.3 and buildx v0.38.1. Each command ran in
cmd, started from PowerShell as cmd /c "... 2>&1" so the
error stream lands in the capture, and the exit code was printed after it. The folder
lab\multi, the stage names build and final and the
image tag fix12-dkbuild-a are the test's own.
Frequently asked
- What does 'ERROR: docker: 'docker buildx build' requires 1 argument' mean?
- docker build was given nothing after its options. In the test the dot at the end of docker build -t name . was missing. Adding it fixed the build.
- Why does docker build say buildx when I typed docker build?
- On this Docker Desktop the error from docker build named docker buildx build, and its usage line read docker buildx build [OPTIONS] PATH | URL | -. The fix was the same: add the dot.
- What goes at the end of docker build?
- The usage line printed in the test says PATH | URL | -. The test used a dot in the folder that holds the Dockerfile, and that build ended with exit code 0.
More decoded errors in the Fixes category. The same
kind of message for docker run is in
'docker run' requires at least 1 argument.