Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

docker

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?

like image 613
Tampa Avatar asked Mar 11 '15 20:03

Tampa


People also ask

How do I fix the docker build requires exactly one argument?

Due to Insufficient Arguments By default we provided dot(.) in the command which specifies the Docker daemon to use the shell's current working directory as the build context: $ docker build . In order to solve this issue, we need to provide the correct file name with -f option.

What is the dot in docker build?

There is a “.” (dot) at the end of the command (which is an alias for $PWD current directory). This tells docker the that the resources for building the image are in the current directory. By default, when you run the docker build command, it looks for a file named Dockerfile in the current directory.

What is an argument in docker?

You can use the ARG command inside a Dockerfile to define the name of a parameter and its default value. This default value can also be overridden using a simple option with the Docker build command.

What is a docker build?

Description. The docker build command builds Docker images from a Dockerfile and a “context”. A build's context is the set of files located in the specified PATH or URL . The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to reference a file in the context ...


1 Answers

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)

like image 118
user2915097 Avatar answered Oct 19 '22 11:10

user2915097