docker: “build” requires 1 argument. See 'dock

2019-01-16 08:50发布

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?

9条回答
Explosion°爆炸
2楼-- · 2019-01-16 09:03

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 .

查看更多
狗以群分
3楼-- · 2019-01-16 09:04

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)

查看更多
劫难
4楼-- · 2019-01-16 09:05

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\
查看更多
唯我独甜
5楼-- · 2019-01-16 09:15

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 .**
查看更多
贼婆χ
6楼-- · 2019-01-16 09:16

enter image description hereJust provide dot (.) at the end of command including one space.

example:

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

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

Thats it.

查看更多
走好不送
7楼-- · 2019-01-16 09:17

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

docker build -t tag .

and not

docker build . -t tag

查看更多
登录 后发表回答