‘docker build’ requires exactly 1 argument

Solved2.54K viewsdocker

‘docker build’ requires exactly 1 argument

I am getting this error while building an image from a dockerfile

+ sudo docker build -t test
'docker build' requires exactly 1 argument.
See 'docker build --help'.
 Usage: docker build [OPTIONS] PATH | URL | -
 Build an image from a Dockerfile
Build step 'Execute shell' marked build as failure
Finished: FAILURE'

vito Edited question June 4, 2021

You need to provide the Dockerfile path as well in the command. If your Dockerfile is in the current location and the name is either dockerfile or Dockerfile, then you can provide . at the end of the command.

sudo docker build -t test .

If not, you need to provide the complete path instead of . with -f parameter.

sudo docker build -f path_to_dockerfile/dockerfile_name -t test

vito Edited answer June 4, 2021

thanks it worked