Add support for compressing build context during image build

When sending a build context to a remote server it may be
(significantly) advantageous to compress the build context. This commit
adds support for gz compression when constructing a build context
using a command like "docker build --compress ."

Signed-off-by: Paul Kehrer <paul.l.kehrer@gmail.com>
This commit is contained in:
Paul Kehrer 2016-08-18 16:35:23 +08:00 committed by Tibor Vass
parent 454f365dfe
commit 9c85295b1c
4 changed files with 8 additions and 1 deletions

View File

@ -758,6 +758,7 @@ _docker_build() {
" "
local boolean_options=" local boolean_options="
--compress
--disable-content-trust=false --disable-content-trust=false
--force-rm --force-rm
--help --help

View File

@ -1509,6 +1509,7 @@ __docker_subcommand() {
$opts_build_create_run \ $opts_build_create_run \
$opts_build_create_run_update \ $opts_build_create_run_update \
"($help)*--build-arg[Build-time variables]:<varname>=<value>: " \ "($help)*--build-arg[Build-time variables]:<varname>=<value>: " \
"($help)--compress[Compress the build context using gzip]" \
"($help -f --file)"{-f=,--file=}"[Name of the Dockerfile]:Dockerfile:_files" \ "($help -f --file)"{-f=,--file=}"[Name of the Dockerfile]:Dockerfile:_files" \
"($help)--force-rm[Always remove intermediate containers]" \ "($help)--force-rm[Always remove intermediate containers]" \
"($help)*--label=[Set metadata for an image]:label=value: " \ "($help)*--label=[Set metadata for an image]:label=value: " \

View File

@ -19,6 +19,7 @@ Options:
--build-arg value Set build-time variables (default []) --build-arg value Set build-time variables (default [])
--cache-from value Images to consider as cache sources (default []) --cache-from value Images to consider as cache sources (default [])
--cgroup-parent string Optional parent cgroup for the container --cgroup-parent string Optional parent cgroup for the container
--compress Compress the build context using gzip
--cpu-period int Limit the CPU CFS (Completely Fair Scheduler) period --cpu-period int Limit the CPU CFS (Completely Fair Scheduler) period
--cpu-quota int Limit the CPU CFS (Completely Fair Scheduler) quota --cpu-quota int Limit the CPU CFS (Completely Fair Scheduler) quota
-c, --cpu-shares int CPU shares (relative weight) -c, --cpu-shares int CPU shares (relative weight)

View File

@ -16,6 +16,7 @@ docker-build - Build a new image from the source code at PATH
[**--label**[=*[]*]] [**--label**[=*[]*]]
[**--no-cache**] [**--no-cache**]
[**--pull**] [**--pull**]
[**--compress**]
[**-q**|**--quiet**] [**-q**|**--quiet**]
[**--rm**[=*true*]] [**--rm**[=*true*]]
[**-t**|**--tag**[=*[]*]] [**-t**|**--tag**[=*[]*]]
@ -84,6 +85,9 @@ set as the **URL**, the repository is cloned locally and then sent as the contex
**--pull**=*true*|*false* **--pull**=*true*|*false*
Always attempt to pull a newer version of the image. The default is *false*. Always attempt to pull a newer version of the image. The default is *false*.
**--compress**=*true*|*false*
Compress the build context using gzip. The default is *false*.
**-q**, **--quiet**=*true*|*false* **-q**, **--quiet**=*true*|*false*
Suppress the build output and print image ID on success. The default is *false*. Suppress the build output and print image ID on success. The default is *false*.