I am trying to build a Docker image from a dockerfile command I received from the previous developer:
bash-5.1$ ls
data_collection demonstrateur.ipynb demo.py Dockerfile examples README.md requirements.txt serious_game start.py test
bash-5.1$ docker build -t serious-game:0.0.1 -t serious-game:latest Dockerfile .
"docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
I am a complete beginner to docker but why did you put two -t arguments? "-t", this seems to tell the main process inside docker that its input is a terminal device.
As written in the docs , Docker uses the file named Dockerfile by default. If you want to specify the file you can use the
--file
or option-f
of the commanddocker build
.In my case I can simply use to solve the problem :
But to specify another file called TestDockerfile (example for testing):
What you say about the terminal is for the subcommand
docker run
. Each docker subcommand has its own options.In the case of
docker build
the option ,-t
it is to put a "tag" on the resulting image. That is the name by which you can later refer to it (which usually includes a version number).From version 1.10 you can repeat the option
-t
to put more than one "tag" (name).Since it gave you an error, that indicates that you have a very old version of docker. I would recommend updating it. However, you can also add tags afterwards. For example:
The first command creates the image with the tag "serious-game:0.0.1" and once the image is created, another tag is assigned with the command
docker tag
.