The command docker build
build an image from a Dockerfile
and a context. A context is the set of files located in the specified PATH
or URL
.
$ docker build [OPTIONS] PATH | URL | -
Here,
--add-host
, --build-arg
, --cache-from
, —memory
or -m
, --label
, —output
, --rm
, --no-cache
, —tag
or -t
, etc.$ docker build .
URL
repositories, from the directory, called cloudyfox
in the branch docker
$ docker build <https://github.com/docker/cloudyfox_repo.git#docker:cloudyfox>
$ docker build <http://cloudyfox-server/context.tar.gz>
$ docker build -t cloudyfox/serverimage:latest .
Dockerfile
(-f
)$ docker build -f Dockerfile.dev .
$ docker build -f Dockerfile.dev -t cloudyfox/serverimage:latest .
STDIN
):$ docker build - < Dockerfile
$ docker build - < context.tar.gz
NOTE: since there is no context, ADD
instruction only works if it refers to a remote URL.