From 0808cf04cbd9939cd3770187ce270d4742893b04 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 6 Apr 2017 13:33:56 +0100 Subject: [PATCH] Add `docker build --iidfile=FILE` This is synonymous with `docker run --cidfile=FILE` and writes the digest of the newly built image to the named file. This is intended to be used by build systems which want to avoid tagging (perhaps because they are in CI or otherwise want to avoid fixed names which can clash) by enabling e.g. Makefile constructs like: image.id: Dockerfile docker build --iidfile=image.id . do-some-more-stuff: image.id do-stuff-with = v1.29 the caller will now see a `JSONMessage` with the `Aux` field containing a `types.BuildResult` in the output stream for each image/layer produced during the build, with the final one being the end product. Having all of the intermediate images might be interesting in some cases. In silent mode (with `-q`) there is no change, on success the only output will be the resulting image digest as it was previosuly. There was no wrapper to just output an Aux section without enclosing it in a Progress, so add one here. Added some tests to integration cli tests. Signed-off-by: Ian Campbell --- docs/reference/commandline/build.md | 1 + man/docker-build.1.md | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/reference/commandline/build.md b/docs/reference/commandline/build.md index 697c63647d..d228853472 100644 --- a/docs/reference/commandline/build.md +++ b/docs/reference/commandline/build.md @@ -35,6 +35,7 @@ Options: -f, --file string Name of the Dockerfile (Default is 'PATH/Dockerfile') --force-rm Always remove intermediate containers --help Print usage + --iidfile string Write the image ID to the file --isolation string Container isolation technology --label value Set metadata for an image (default []) -m, --memory string Memory limit diff --git a/man/docker-build.1.md b/man/docker-build.1.md index b650fc3aa2..59eba003a0 100644 --- a/man/docker-build.1.md +++ b/man/docker-build.1.md @@ -11,6 +11,7 @@ docker-build - Build an image from a Dockerfile [**--cpu-shares**[=*0*]] [**--cgroup-parent**[=*CGROUP-PARENT*]] [**--help**] +[**--iidfile**[=*CIDFILE*]] [**-f**|**--file**[=*PATH/Dockerfile*]] [**-squash**] *Experimental* [**--force-rm**] @@ -104,6 +105,9 @@ option can be set multiple times. **--no-cache**=*true*|*false* Do not use cache when building the image. The default is *false*. +**--iidfile**="" + Write the image ID to the file + **--help** Print usage statement