mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #33185 from tonistiigi/docs-build-target
docs: add docs for build —target
This commit is contained in:
commit
4dbea104ca
2 changed files with 27 additions and 0 deletions
|
@ -57,6 +57,7 @@ Options:
|
||||||
or `g` (gigabytes). If you omit the unit, the system uses bytes.
|
or `g` (gigabytes). If you omit the unit, the system uses bytes.
|
||||||
--squash Squash newly built layers into a single new layer (**Experimental Only**)
|
--squash Squash newly built layers into a single new layer (**Experimental Only**)
|
||||||
-t, --tag value Name and optionally a tag in the 'name:tag' format (default [])
|
-t, --tag value Name and optionally a tag in the 'name:tag' format (default [])
|
||||||
|
--target string Set the target build stage to build.
|
||||||
--ulimit value Ulimit options (default [])
|
--ulimit value Ulimit options (default [])
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -454,6 +455,24 @@ more `--add-host` flags. This example adds a static address for a host named
|
||||||
|
|
||||||
$ docker build --add-host=docker:10.180.0.1 .
|
$ docker build --add-host=docker:10.180.0.1 .
|
||||||
|
|
||||||
|
### Specifying target build stage (--target)
|
||||||
|
|
||||||
|
When building a Dockerfile with multiple build stages, `--target` can be used to
|
||||||
|
specify an intermediate build stage by name as a final stage for the resulting
|
||||||
|
image. Commands after the target stage will be skipped.
|
||||||
|
|
||||||
|
```Dockerfile
|
||||||
|
FROM debian AS build-env
|
||||||
|
...
|
||||||
|
|
||||||
|
FROM alpine AS production-env
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker build -t mybuildimage --target build-env .
|
||||||
|
```
|
||||||
|
|
||||||
### Squash an image's layers (--squash) **Experimental Only**
|
### Squash an image's layers (--squash) **Experimental Only**
|
||||||
|
|
||||||
#### Overview
|
#### Overview
|
||||||
|
|
|
@ -8,6 +8,7 @@ docker-build - Build an image from a Dockerfile
|
||||||
**docker build**
|
**docker build**
|
||||||
[**--add-host**[=*[]*]]
|
[**--add-host**[=*[]*]]
|
||||||
[**--build-arg**[=*[]*]]
|
[**--build-arg**[=*[]*]]
|
||||||
|
[**--cache-from**[=*[]*]]
|
||||||
[**--cpu-shares**[=*0*]]
|
[**--cpu-shares**[=*0*]]
|
||||||
[**--cgroup-parent**[=*CGROUP-PARENT*]]
|
[**--cgroup-parent**[=*CGROUP-PARENT*]]
|
||||||
[**--help**]
|
[**--help**]
|
||||||
|
@ -31,6 +32,7 @@ docker-build - Build an image from a Dockerfile
|
||||||
[**--cpu-quota**[=*0*]]
|
[**--cpu-quota**[=*0*]]
|
||||||
[**--cpuset-cpus**[=*CPUSET-CPUS*]]
|
[**--cpuset-cpus**[=*CPUSET-CPUS*]]
|
||||||
[**--cpuset-mems**[=*CPUSET-MEMS*]]
|
[**--cpuset-mems**[=*CPUSET-MEMS*]]
|
||||||
|
[**--target**[=*[]*]]
|
||||||
[**--ulimit**[=*[]*]]
|
[**--ulimit**[=*[]*]]
|
||||||
PATH | URL | -
|
PATH | URL | -
|
||||||
|
|
||||||
|
@ -93,6 +95,9 @@ option can be set multiple times.
|
||||||
or for variable expansion in other Dockerfile instructions. This is not meant
|
or for variable expansion in other Dockerfile instructions. This is not meant
|
||||||
for passing secret values. [Read more about the buildargs instruction](https://docs.docker.com/engine/reference/builder/#arg)
|
for passing secret values. [Read more about the buildargs instruction](https://docs.docker.com/engine/reference/builder/#arg)
|
||||||
|
|
||||||
|
**--cache-from**=""
|
||||||
|
Set image that will be used as a build cache source.
|
||||||
|
|
||||||
**--force-rm**=*true*|*false*
|
**--force-rm**=*true*|*false*
|
||||||
Always remove intermediate containers, even after unsuccessful builds. The default is *false*.
|
Always remove intermediate containers, even after unsuccessful builds. The default is *false*.
|
||||||
|
|
||||||
|
@ -233,6 +238,9 @@ two memory nodes.
|
||||||
If the path is not absolute, the path is considered relative to the `cgroups` path of the init process.
|
If the path is not absolute, the path is considered relative to the `cgroups` path of the init process.
|
||||||
Cgroups are created if they do not already exist.
|
Cgroups are created if they do not already exist.
|
||||||
|
|
||||||
|
**--target**=""
|
||||||
|
Set the target build stage name.
|
||||||
|
|
||||||
**--ulimit**=[]
|
**--ulimit**=[]
|
||||||
Ulimit options
|
Ulimit options
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue