Building an image in Docker
Simple build
To build a container you can simply type:
$docker image build .
Warning
This . at the end represents the context, where . means all files in this directory and subdirectory must be passed into the docker daemon for the build.
However this requires that you have a Dockerfile in the directory. For any different cas you will need to use the flags below to control how the code will assemble the image.
Some of the flags available are the following:
Flag |
Effect |
|---|---|
-t <image tag>
|
Tags the image as <image tag>.
|
-f <path to Dockerfile>
|
Gives the build the path to a Dockerfile.
|
For more advanced commands refer to the official Docker documentation.