Why can't build the docker image? - docker

I want to create a docker image according to the tutorial.create docker image
1.vim wechat.Dockerfile ,paste all lines into the file.
ls -al wechat.Dockerfile
-rw-r--r-- 1 debian debian 1217 Apr 29 10:21 wechat.Dockerfile
2.Build docker image with commands:
docker build -f "wechat.Dockerfile" --tag=wechat:0.0.1
Info:
"docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
debian#debian:/tmp$ docker build -f wechat.Dockerfile --tag=wechat:0.0.1
"docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Add . at the end of command:
docker build -f wechat.Dockerfile --tag=wechat:0.0.1 .
error checking context: 'can't stat '/tmp/systemd-private-ad10f6d540654f2791399efb421b6134-ModemManager.service-V2Upfj''.
No image 'wechat:0.0.1' created in current directory.

The command given is actually
docker build -f wechat.Dockerfile --tag=wechat:0.0.1 .
The final period is important, and denotes the current directory.

Related

How to specify GIT_ACCESS_TOKEN for the docker build command?

I run this command
docker build GIT_ACCESS_TOKEN=my_token -t "${IMAGE}" .
and got this error
"docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
But as you see above, I do have a dot at the end of the docker build command. Besides, docker build . -t "${IMAGE}" works for me, so it seems the error is introduced at GIT_ACCESS_TOKEN part?
Are you looking for build-arg?
docker build --build-arg GIT_ACCESS_TOKEN=my_token -t "${IMAGE}" .

Why isn't docker recognizing my "-f" option?

Following this post -- docker: "build" requires 1 argument. See 'docker build --help', I'm trying to build my docker image using a file with a non-traditional name ("local.Dockerfile") on Mac 10.13.6. I tried the below
localhost:mydir davea$ docker build -t mycontainer -f local.Dockerfile
"docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
But docker is choking on me. I'm running version 19.03.5.
Basic command to build docker image:
docker build -t <image_tag> -f <Dockerfile_name> <Path_of_Dockerfile>
So you are missing to specify the path of your local.Dockerfile (which is mandatory). If your dockerfile is in the current directory from where you are running the command, then run below command, else update the path accordingly:
docker build -t mycontainer -f local.Dockerfile .
Note: You can specify the Path_of_Dockerfile in any way: relative path or absolute path, whichever way you feel comfortable.

Unable to build docker image [duplicate]

This question already has answers here:
docker: "build" requires 1 argument. See 'docker build --help'
(17 answers)
Closed 3 years ago.
i want to build a docker image. I do this:
$ docker build -f Dockerfile -t $IMAGE_TAG
I have this error:
"docker build" requires exactly 1 argument. See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | - Build an image from a
Dockerfile ERROR: Job failed: exit code 1
$ docker build -f Dockerfile -t $IMAGE_TAG .
The current directory dot . is missing at the end in your command line

Docker build,where to run?

I am learning Docker
docker build -t mm/cowsay .
Should I go to cowsay folder or should I run it from my home mm directory?
I have registered on Docker hub.
The docker build command follows instructions specified in a given Dockerfile, and outputs an image.
Syntax:
docker build \
-t <tag-of-output-image> \
-f <path-to-dockerfile>
If you use . instead of -f <path-to-dockerfile>, you are telling the Docker Engine to use the Dockerfile in the current directory.
So you need to run your command from where the Dockerfile exists.

Docker build dockerfile

I am trying to build a docker image from dockerfile which I have written.
docker build -f ~/www/node-beta.dockerfile
This however results in the error:
docker: "build" requires 1 argument. See 'docker build --help'.
The docker build command always requires a location argument. In this case you should use ~/www/ as the for the location argument, and the file name, "node-beta.dockerfile" for the -f (filename) argument.
docker build -f node-beta.dockerfile ~/www
sudo docker build -t yee/haw -f ~/www/node-beta.dockerfile ~/www/

Resources