-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Proposal: DAG image builder (can execute muti-stage build in parallel) #32550
Comments
I would prefer to have a fine grained DAG. Possibly even more fine grained than a direct equivalent to the dockerfile commands (opening optimizations like auto commit squashing, squashing of multiple ENV / COPY calls, more precise dependency management opening more parallelism etc.) For exemple if you take
we could run foo and img2 context in parallel until we actually need to COPY from foo. |
Fine grained DAG could be a continuation on this proposal? I see benefits in having that, but also agree that adding complication at the start may not be wise; happy to hear from others though! |
While this looks like an interesting optimization, given the newness of some of the features this requires (like the multi-stage build), I'd prefer to wait until we know how well people react and use the existing new build features before we introduce something like this. |
In addition to my comments in #32402 (comment) I wrote a proposal for a direction this could take https://gist.github.com/tonistiigi/059fc72c4630f066d94dafb5e0e70dc6 . Please note that that is only a proposal, there in nobody developing that atm. I think the correct ways to get started on this would be:
I think specifically skipping unnecessary stages is a good goal to take before tackling what configuration of parallelization would be optimum. It would also make it possible for #32487 to build images for multiple operating systems. @AkihiroSuda or anyone else, if the above looks good to you, let me know if you would be interested in helping with any of this or #32904 (or actually any builder proposal). We can do a quick design discussion or live design doc for the specific items. |
Thank you a lot for working on this, SGTM 👍.
Now this section would need to be rewritten for "docker product" and "moby project" (cc @shykes @moby/moby-maintainers)
With regarding to "git repositories, http archives" sources, do you plan to add more remote sources? (Then it might be good to consider more modularization) Or are they just for compatibility with the current implementation?
I wonder we can just use containerd snapshot drivers for simplicity.
👍 Also, it might be good to consider P2P caching here? |
Buildkit itself should be quite open about adding new sources.
We definitely one to rely on containerd snapshot drivers for the actual implementation. One of the issues is that for
Agree, but one problem at a time. I think I'll open up a new issue with that proposal even if the code for it would not end up in this repo so we don't have to share the gist. We can discuss there if we are ready to open a new repo etc. |
Should we close this issue for housekeeping purpose? Now we have buildkit repo: https://github.com/moby/buildkit |
Let's keep it open to track this issue in this repo, since the builder is still here. |
ok |
Now BuildKit supports converting Dockerfile to LLB DAG 🎉 |
@tonistiigi @AkihiroSuda should we close this one as |
This is being integrated to Docker/Moby via PR #37151 🎉 @vdemeester Probably after merging the PR? |
@AkihiroSuda yes 👍 |
Let's close this one as #37151 has been merged now 🎉 |
Proposal
Beginning from 17.05, Docker supports "multi-stage" Dockerfile.
My proposal is to convert such Dockerfile to DAG internally, and execute it in parallel.
No change to file format nor UX
POC is available: #32402
Tasks
Implement generic DAG utility
I made a small generic DAG package: https://github.com/AkihiroSuda/go-dag
If this design is correct, I think we can vendor this package (or just copy it to
github.com/docker/docker/pkg/dag
)Determine Dockerfile DAG granularity
Alternatively, we could use fine-grained DAG like this, but I'm -1 ATM, because it is likely to cause implementation issue
Refactor
builder
pkg to create DAGMy previous POC (#32402) was implemented in weird way:
builder/dockerfile/parser
(unchanged): parsesDockerfile
text and returns parsed tree structurebuilder/dockerfile/parallel
: re-parses output frombuilder/dockerfile/parser
, and creates DAGRe-parsing output from
builder/dockerfile/parser
is likely to cause implementation issue; actually I forgot to implement support forARG
.Rather, we should refactor
builder/dockerfile/parser
to emit DAG directly.Investigate other usecases of DAG
#32402 (comment)
Investigate why
docker build
is slowStorage driver seems being bottleneck, but haven't looked into this deeper
#9656
#32402 (comment)
#32402 (comment)
cc @tonistiigi @dnephin @aaronlehmann @vdemeester @cpuguy83 @simonferquel @thaJeztah
The text was updated successfully, but these errors were encountered: