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

Trying to follow the instructions for building a docker image from the docker website.

this is the error I get will following the instructions on the doc and using this Dockerfile

FROM        ubuntu:14.04
RUN         apt-get update && apt-get install -y redis-server
EXPOSE      6379
ENTRYPOINT  ["/usr/bin/redis-server"]

sudo docker build -t myrepo/redis
docker: "build" requires 1 argument. See 'docker build --help'.

How do resolve?


You need to add a dot, example docker build -t mytag . it means you use the Dockerfile in the local directory, and if you use docker 1.5 you can specify a Dockerfile otherwhere, extract from the help of docker build -f, --file="" Name of the Dockerfile(Default is 'Dockerfile' at context root)

Did you copy the build command from somewhere else (webpage or some other file)? Try typing it in from scratch.

I copied a build command from an AWS tutorial and pasted it into my terminal and was getting this error. It was driving me crazy. After typing it in by hand, it worked! Looking closer and my previous failed commands, I noticed the "dash" character was different, it was a thinner, longer dash character than I got if I typed it myself using the "minus/dash" key.


sudo docker build –t foo .


sudo docker build -t foo .

Can you see the difference?.. Cut and paste is hard.

Use the following command

docker build -t mytag .

Note that mytag and dot has a space between them . This dot represents the present working directory .

Just provide dot (.) at the end of command including one space.


command: docker build -t "blink:v1" .

Here you can see "blink:v1" then a space then dot(.)

Thats it.

You Need a DOT at the end...

So for example:

$ docker build -t <your username>/node-web-app .

It's a bit hidden, but if you pay attention to the . at the end...

On older versions of Docker it seems you need to use this order:

docker build -t tag .

and not

docker build . -t tag

You can build docker image from a file called docker file and named Dockerfile by default. It has set of command/instruction that you need in your docker container. Below command creates image with tag latest, Dockerfile should present on that location (. means present direcotry)

docker build . -t <image_name>:latest

You can specify the Dockerfile via -f if the file name in not default (Dockerfile) Sameple Docker file contents.

FROM busybox
RUN echo "hello world"

Open PowerShelland and follow these istruction. This type of error is tipically in Windows S.O. When you use command build need an option and a path.

There is this type of error becouse you have not specified a path whit your Dockerfile.

Try this:

C:\Users\Daniele\app> docker build -t friendlyhello C:\Users\Daniele\app\
  1. friendlyhello is the name who you assign to your conteiner
  2. C:\Users\Daniele\app\ is the path who conteins your Dockerfile

if you want to add a tag

C:\Users\Daniele\app> docker build -t friendlyhello:3.0 C:\Users\Daniele\app\

My problem was the Dockerfile.txt needed to be converted to a Unix executable file. Once I did that that error went away.

You may need to remove the .txt portion before doing this, but on a mac go to terminal and cd into the directory where your Dockerfile is and the type

chmod +x "Dockerfile"

And then it will convert your file to a Unix executable file which can then be executed by the Docker build command.

In my case this error was happening in a Gitlab CI pipeline when I was passing multiple Gitlab env variables to docker build with --build-arg flags.

Turns out that one of the variables had a space in it which was causing the error. It was difficult to find since the pipeline logs just showed the $VARIABLE_NAME.

Make sure to quote the environment variables so that spaces get handled correctly.

Change from:




Docker Build Command Format

In your powershell : There is this type of error because you have not specified a path whith your Dockerfile.

Try this:

$ docker build -t friendlyhello:latest -f C:\\TestDockerApp\\Dockerfile.txt

friendlyhello is the name you assign to your container and add the version , just use the :latest

-f C:\TestDockerApp\Dockerfile.txt - you want to add a tag because the build command needs a parameter or tag - The DockerFile is a text document so explicitly add the extension .txt

**Try this format :

$ docker build -t friendlyhello:latest -f C:\\TestDockerApp\\Dockerfile.txt .**

Need Your Help

How do I fix PyDev "Undefined variable from import" errors?

python code-analysis pydev

I've got a Python project using PyDev in Eclipse, and PyDev keeps generating false errors for my code. I have a module settings that defines a settings object. I import that in module b and assig...

How many socket connections can a web server handle?

http tcp network-programming hosting tcplistener

Say if I was to get shared, virtual or dedicated hosting, I read somewhere a server/machine can only handle 64,000 TCP connections at one time, is this true? How many could any type of hosting handle