mirror of https://github.com/docker/cli.git
Add ability to add multiple tags with docker build
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
This commit is contained in:
parent
a41d4dbdde
commit
9d9976ae3a
|
@ -62,6 +62,11 @@ the build succeeds:
|
||||||
|
|
||||||
$ docker build -t shykes/myapp .
|
$ docker build -t shykes/myapp .
|
||||||
|
|
||||||
|
To tag the image into multiple repositories after the build,
|
||||||
|
add multiple `-t` parameters when you run the `build` command:
|
||||||
|
|
||||||
|
$ docker build -t shykes/myapp:1.0.2 -t shykes/myapp:latest .
|
||||||
|
|
||||||
The Docker daemon runs the instructions in the `Dockerfile` one-by-one,
|
The Docker daemon runs the instructions in the `Dockerfile` one-by-one,
|
||||||
committing the result of each instruction
|
committing the result of each instruction
|
||||||
to a new image if necessary, before finally outputting the ID of your
|
to a new image if necessary, before finally outputting the ID of your
|
||||||
|
|
|
@ -31,7 +31,7 @@ parent = "smn_cli"
|
||||||
--pull=false Always attempt to pull a newer version of the image
|
--pull=false Always attempt to pull a newer version of the image
|
||||||
-q, --quiet=false Suppress the verbose output generated by the containers
|
-q, --quiet=false Suppress the verbose output generated by the containers
|
||||||
--rm=true Remove intermediate containers after a successful build
|
--rm=true Remove intermediate containers after a successful build
|
||||||
-t, --tag="" Repository name (and optionally a tag) for the image
|
-t, --tag=[] Name and optionally a tag in the 'name:tag' format
|
||||||
--ulimit=[] Ulimit options
|
--ulimit=[] Ulimit options
|
||||||
|
|
||||||
Builds Docker images from a Dockerfile and a "context". A build's context is
|
Builds Docker images from a Dockerfile and a "context". A build's context is
|
||||||
|
@ -227,6 +227,14 @@ uploaded context. The builder reference contains detailed information on
|
||||||
This will build like the previous example, but it will then tag the resulting
|
This will build like the previous example, but it will then tag the resulting
|
||||||
image. The repository name will be `vieux/apache` and the tag will be `2.0`
|
image. The repository name will be `vieux/apache` and the tag will be `2.0`
|
||||||
|
|
||||||
|
You can apply multiple tags to an image. For example, you can apply the `latest`
|
||||||
|
tag to a newly built image and add another tag that references a specific
|
||||||
|
version.
|
||||||
|
For example, to tag an image both as `whenry/fedora-jboss:latest` and
|
||||||
|
`whenry/fedora-jboss:v2.1`, use the following:
|
||||||
|
|
||||||
|
$ docker build -t whenry/fedora-jboss:latest -t whenry/fedora-jboss:v2.1 .
|
||||||
|
|
||||||
### Specify Dockerfile (-f)
|
### Specify Dockerfile (-f)
|
||||||
|
|
||||||
$ docker build -f Dockerfile.debug .
|
$ docker build -f Dockerfile.debug .
|
||||||
|
|
|
@ -16,7 +16,7 @@ docker-build - Build a new image from the source code at PATH
|
||||||
[**--pull**[=*false*]]
|
[**--pull**[=*false*]]
|
||||||
[**-q**|**--quiet**[=*false*]]
|
[**-q**|**--quiet**[=*false*]]
|
||||||
[**--rm**[=*true*]]
|
[**--rm**[=*true*]]
|
||||||
[**-t**|**--tag**[=*TAG*]]
|
[**-t**|**--tag**[=*[]*]]
|
||||||
[**-m**|**--memory**[=*MEMORY*]]
|
[**-m**|**--memory**[=*MEMORY*]]
|
||||||
[**--memory-swap**[=*MEMORY-SWAP*]]
|
[**--memory-swap**[=*MEMORY-SWAP*]]
|
||||||
[**--cpu-period**[=*0*]]
|
[**--cpu-period**[=*0*]]
|
||||||
|
@ -82,7 +82,7 @@ set as the **URL**, the repository is cloned locally and then sent as the contex
|
||||||
Remove intermediate containers after a successful build. The default is *true*.
|
Remove intermediate containers after a successful build. The default is *true*.
|
||||||
|
|
||||||
**-t**, **--tag**=""
|
**-t**, **--tag**=""
|
||||||
Repository name (and optionally a tag) to be applied to the resulting image in case of success
|
Repository names (and optionally with tags) to be applied to the resulting image in case of success.
|
||||||
|
|
||||||
**-m**, **--memory**=*MEMORY*
|
**-m**, **--memory**=*MEMORY*
|
||||||
Memory limit
|
Memory limit
|
||||||
|
@ -235,6 +235,14 @@ If you do not provide a version tag then Docker will assign `latest`:
|
||||||
|
|
||||||
When you list the images, the image above will have the tag `latest`.
|
When you list the images, the image above will have the tag `latest`.
|
||||||
|
|
||||||
|
You can apply multiple tags to an image. For example, you can apply the `latest`
|
||||||
|
tag to a newly built image and add another tag that references a specific
|
||||||
|
version.
|
||||||
|
For example, to tag an image both as `whenry/fedora-jboss:latest` and
|
||||||
|
`whenry/fedora-jboss:v2.1`, use the following:
|
||||||
|
|
||||||
|
docker build -t whenry/fedora-jboss:latest -t whenry/fedora-jboss:v2.1 .
|
||||||
|
|
||||||
So renaming an image is arbitrary but consideration should be given to
|
So renaming an image is arbitrary but consideration should be given to
|
||||||
a useful convention that makes sense for consumers and should also take
|
a useful convention that makes sense for consumers and should also take
|
||||||
into account Docker community conventions.
|
into account Docker community conventions.
|
||||||
|
|
Loading…
Reference in New Issue