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 <image.id
Currently the only way to achieve this is to use `docker build -q` and capture
the stdout, but at the expense of losing the build output.
In non-silent mode (without `-q`) with API >= 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 <ian.campbell@docker.com>
Upstream-commit: 5894bc1abf8186802d360d20739b57bfffed51df
Component: engine
Remove runConfig from Builder and dispatchRequest. It is not only on
dispatchState.
Move dispatch state fields from Builder to dispatchState
Move stageName tracking to dispatchRequest.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 2f0ebba0e7f43908a41d5ff9bbb1b9b78743a6ab
Component: engine
Update a test to use a base image with entrypoint to that the linux build
has at least one test that behaves like all the windows tests.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: d9371ee80764d0eecf7b8a562121f0a6234167a3
Component: engine
Set a blank entrypoint to preserve the old behaviour.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 97f860716497f6f75236b72e4af90e01afad832c
Component: engine
Previously this value was set at some point attrbitrarily between when it was updated and when it was going to be used next.
Instead always set it as the last step of dispatch.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 3dcab289821ddd4575b7e48d463ba8ef2af492ea
Component: engine
StreamFormatter suffered was two distinct structs mixed into a single struct
without any overlap.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c87d67b0ad788a6a80d1af89488e2d1f22726c34
Component: engine
Instead of mutating and reverting, just create a copy and pass the copy
around.
Add a unit test for builder dispatcher.run
Fix two test failures
Fix image history by adding a CreatedBy to commit options. Previously the
createdBy field was being created by modifying a reference to the runConfig that
was held from when the container was created.
Fix a test that expected a trailing slash. Previously the runConfig was being
modified by container create. Now that we're creating a copy of runConfig
instead of sharing a reference the runConfig retains the trailing slash.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 9f738cc574d50d0a2accdf6f6deb30405c24a80c
Component: engine
Remove pathCache and replace it with syncmap
Cleanup NewBuilder
Create an api/server/backend/build
Extract BuildTagger
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 0296797f0f39477d675128c93c1646b3186937ee
Component: engine
Remove unused arguments to commit.
This will allow us to remove all the runConfig mutate+revert code that
is scattered around builder dispatchers/internals
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 0d9e66b98ac9237b561d9beee5ecfe6a133ffc8f
Component: engine
The previous implementation would error out with "Unexpected EOF" which
was caused by an underlying "array index out-of-bounds" error.
The root cause was deleting items from the same array that was being
iterated over. The iteration was unaware that the array size had
changed, resulting in an error.
The new implementation builds a new array instead of mutating a copy of
the old one.
Fixes: #32744
Signed-off-by: Dave Tucker <dt@docker.com>
Upstream-commit: 1076ab58ec92637a1a157d8dfbb7625d7bba6c40
Component: engine
In preparation for removing it from builder.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 52626bb9199ca3562fa70f14d8fc7b8c12c8b0f5
Component: engine
This change starts the process of splitting up the Builder into logical
components. Remove builder.flags and move it to the new dispatchRequest
object.
Use runConfig from dispatchRequest instead of from the builder.
More progress removing things from the Builder struct.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: e59327aaac338bd350746e0e6479489f21a0a1fa
Component: engine
I noticed that we're using a homegrown package for assertions. The
functions are extremely similar to testify, but with enough slight
differences to be confusing (for example, Equal takes its arguments in a
different order). We already vendor testify, and it's used in a few
places by tests.
I also found some problems with pkg/testutil/assert. For example, the
NotNil function seems to be broken. It checks the argument against
"nil", which only works for an interface. If you pass in a nil map or
slice, the equality check will fail.
In the interest of avoiding NIH, I'm proposing replacing
pkg/testutil/assert with testify. The test code looks almost the same,
but we avoid the confusion of having two similar but slightly different
assertion packages, and having to maintain our own package instead of
using a commonly-used one.
In the process, I found a few places where the tests should halt if an
assertion fails, so I've made those cases (that I noticed) use "require"
instead of "assert", and I've vendored the "require" package from
testify alongside the already-present "assert" package.
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 6052f2b3969feadb01662d8e2f30337d9c7f61af
Component: engine
Rename the methods to match my understanding of the behaviour.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: aafd7fa96909f48e43fd1b785c3c3a1f8b656ede
Component: engine
This helps clarify the difference cases for parsing ctxName, and for
getting an image.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4d62f67117ca515671fcc882807bfc4862067ea6
Component: engine
Addresses part of #32140, in particular:
- this will make it so that double backslashes in double-quoted
strings will result in a single backslash. While in single quotes it remains
a double backslash.
- missing closing " and ' will now generate an error
Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 2fb7c3c4f0b2fe15e279729a87c465df4fa70879
Component: engine
Remove the block comment which is stale, and redundant now that the
function is just as readable as the comment.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: bfcd95817afaedb078022fc2f335ead64afee55c
Component: engine
Remove commented code blocks
Remove some duplication in comparing and restructuring env
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c7fad9b750f8f143a22cc5a85a1dc26573025414
Component: engine
Return dockerfile from parseDockerfile and pass the dockerfile nodes
as an arg
Strip unused arg from builder.NewBuilder.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f3e205ddc15040ec80ef047959afa7b75586a491
Component: engine