ERROR: "docker buildx build" requires exactly 1 argument. with VS code

Hello,

After reading a lot of documentation and searching on the internet, I can’t find where come from this issue.

When i want to buid a image with a right clic and “Build image” this error showing
“ERROR: “docker buildx build” requires exactly 1 argument. with VS code”.

The command VS execute
Executing task: docker build --pull --rm -f “Dockerfile\Exemple 1\Dockerfile” -t test_test:latest “Dockerfile\Exemple 1”

When I try to build my image from terminal
"image build -t test:lastest ."
It’s work fine.

I’m new in the Docker univers and I think is just something i’m missing but i can’t find what :confused:
If anyone can help me a bit, thank you !

You say vscode executes a docker build command without buildx but compains about buildx build requiring exactly one argument. Are you sure you shared the exact commands? And what is

image build -t test:lastest

?
Although usually it is not recomended, this is the time of copy-pasting :slight_smile: and sharing the exact commands you ran or explaining a command if that is not standard docker command.

The command “image build -t test:lastest” is the command i run to build my image with the terminal (without VS code) and i’m in the folder where the Dockerfile is.

And here the full error from the terminal when I do a right clic on the dockerfile and try “Build image”

Please, use </> button to share codes, terminal outputs, error messages instead of sharing screenshots. That helps others to search for similar issues and us to read it more easily and quote parts of the message so we can help you more quickly. You can find a complete guide in the following post: How to format your forum posts

I can’t quote, but ther eis a possible issue their which is the space in the folder name. It seems vs code wants to run a command through powershell so it passes the command as an argument. It may be perfectly okay, but this is my only guess so far.

 Executing task: docker build --pull --rm -f "Dockerfile\Exemple 1\Dockerfile" -t udemydocker:latest "Dockerfile\Exemple 1" 

ERROR: "docker buildx build" requires exactly 1 argument.
See 'docker buildx build --help'.

Usage:  docker buildx build [OPTIONS] PATH | URL | -     

Start a build

 *  The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command docker build --pull --rm -f "Dockerfile\Exemple 1\Dockerfile" -t udemydocker:latest "Dockerfile\Exemple 1"" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Hrtr the full log, and after testing with others Dockerfile on other project, It work fine.

Thank you for the full log. I tried an intentionally wrong comand on my machine

docker build --pull --rm -f "Dockerfile\Exemple 1\Dockerfile" -t udemydocker:latest Dockerfile\Exemple 1

I removed the quotation marks around the last argument and got the same error message mentioning buildx. The default docker build command uses buildx behind the scenes, but I didn’t expect it to be in an error message. Based on this I think what I wrote in my previous message

Does your other projects have spaces in the path?

I remove the space and It work perfectly. Thank vm, I didn’t pay attention at all
Thanks !

Hello, this could be considered as an off topic answer.

I got the same error while trying to build the image in my case I forgot the dot . at the end of the docker build command.

docker build -f '.docker/http/Dockerfile' --target my-target --label my-label

Solution:

docker build -f '.docker/http/Dockerfile' --target my-target --label my-label .

2 Likes