Closeddocker: “build” requires 1 argument. See 'docker build --help'

723    Asked by AshishSinha in Devops , Asked on Apr 20, 2021

So I've been getting into docker and for this, I've been following the docker documentation.So for my doubt, I've been specifically following this instruction for creating a docker image : But I keep on getting an error while following it exactly, here are my dockerfile and build command and the error:

My dockerfile :

FROM        ubuntu:14.04
RUN         apt-get update && apt-get install -y redis-server
EXPOSE      6379
ENTRYPOINT  ["/usr/bin/redis-server"]
Docker build command :
$ sudo docker build -t myrepo/redis
Error:
docker: "build" requires 1 argument. See 'docker build --help'.
How to remove  error ”docker build requires exactly 1 argument”. Can someone help me solution.
FROM ubuntu:14.04 RUN apt-get update && apt-get install -y redis-server EXPOSE 6379 ENTRYPOINT ["/usr/bin/redis-server"]
FROM        ubuntu:14.04
RUN         apt-get update && apt-get install -y redis-server
EXPOSE      6379
ENTRYPOINT  ["/usr/bin/redis-server"]


Answered by Ashish Sinha

You are getting this error as you forgot to add the dot after 'build'.

You need to type in the command like this :

      $ sudo docker build . -t < name>

The dot basically tells docker that the dockerfile that has to be used is in the current directory.

If you wish to specify a dockerfile that is not located in the local/current directory you can do so in docker v 1.5 like so :

      $ sudo docker build --file="" -t < name>

Here --file specifies Name of the Dockerfile where the Default is ‘PATH/Dockerfile’.

Try typing in the commands when you refer tutorials and instructions, you will get less such errors and more practice.

Hope that helped 



Your Answer

Interviews

Parent Categories