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

Tampa picture Tampa · Mar 11, 2015 · Viewed 222k times · Source

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

https://docs.docker.com/examples/running_redis_service/

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?

Answer

user2915097 picture user2915097 · Mar 11, 2015

You need to add a dot, which means to use the Dockerfile in the local directory.

For 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 elsewhere. Extract from the help output from docker build:

-f, --file="" Name of the Dockerfile(Default is 'Dockerfile' at context root)