-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dockerfile: add support for named contexts #2521
dockerfile: add support for named contexts #2521
Conversation
eedec9c
to
d2f85d4
Compare
Added additional test for series of multi-platform builds passing result from first to the next one. |
Stages and implicit stages from image names can be redefined with build options. This enables using more that one source directory and reusing results from other builds. This can also be used to use a local image from other build without including a registry. Contexts need to be defined as `context:name=` frontend options. The value can be image, git repository, URL, local directory or a frontend input. Signed-off-by: Tonis Tiigi <[email protected]>
Signed-off-by: Tonis Tiigi <[email protected]>
Signed-off-by: Tonis Tiigi <[email protected]>
bd0d7d3
to
23709ef
Compare
Looks great! I have this use case where loaded a local image would be helpful instead of using a local registry. |
@tonistiigi This feature seems really useful. It would be nice to add it to the documentation. Based upon your changeset it seems your options are:
|
|
Is the example you linked correct? It just has Why can't In any case, I would not generally look to the buildx documentation for buildctl, so it would be nice if it were documented here too. |
Yes. Buildx has a new flag for this. Buildctl has generic
Because there is nothing that keeps the result allocated when your first build completes. Pipelines of multiple builds are out of scope for buildctl which is a test client.
This is a Dockerfile frontend feature. Other frontends can of course use the same keys to also connect to |
I'm confused. To be honest, right now the various I'm also not sure what you mean by buildctl being a "test client". The docs never refer to it as such. |
Related moby/moby#37129
Related docker/buildx#447 (comment)
Stages and implicit stages from image names can be
redefined with build options.
This enables using more that one source directory
and reusing results from other builds. This can also
be used to use a local image from other build without
including a registry.
Contexts need to be defined as
context:name=
frontendoptions. The value can be image, git repository,
URL, local directory, or a frontend input.
E.g.
buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=. --opt context:alpine=docker-image://alpine:3.15
buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=. --local base=path/to/base --opt context:base=local:base
Signed-off-by: Tonis Tiigi [email protected]