-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Set buildx as default builder #3314
Conversation
1aa0c06
to
fd9759a
Compare
4ecdc42
to
1d5ae62
Compare
Codecov Report
@@ Coverage Diff @@
## master #3314 +/- ##
==========================================
+ Coverage 56.36% 57.33% +0.97%
==========================================
Files 304 304
Lines 26816 26379 -437
==========================================
+ Hits 15114 15124 +10
+ Misses 10782 10329 -453
- Partials 920 926 +6 |
c89759f
to
d86e8c9
Compare
18cdcf8
to
13fb7d3
Compare
d2ae311
to
fc290ee
Compare
@crazy-max Looks like the stderr change broke a test. Just issue with the test assert iiuc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (left two minor suggestions)
88840a6
to
a47c645
Compare
a47c645
to
f57a76b
Compare
Signed-off-by: CrazyMax <[email protected]>
afcd4d6
to
16edf8b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Bringing this one in (discussed in the maintainers meeting, and @cpuguy83 will complain after release 😂) |
@@ -169,20 +168,6 @@ func (cli *DockerCli) ContentTrustEnabled() bool { | |||
return cli.contentTrust | |||
} | |||
|
|||
// BuildKitEnabled returns whether buildkit is enabled either through a daemon setting | |||
// or otherwise the client-side DOCKER_BUILDKIT environment variable | |||
func BuildKitEnabled(si ServerInfo) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker/compose relies on this to select the builder to be used.
Maybe restore this function as a dumb return true
would make more sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the logic was moved inside processBuilder()
. Perhaps it makes sense to move that logic back into this function. The default would now be (true
) if DOCKER_BUILDKIT
is not set?
Wondering if the function also needs to take windows
daemon into account 🤔
How exactly is it used in Compose (as in; what does it do if it's "disabled"? or is that only for the Windows case?)
Related: moby/moby#42350 |
This is a first part to the effort to migrate users to buildx as the default builder.
tldr;
The default experience will be the same as the current
DOCKER_BUILDKIT=1
experience. This was the default experience for Docker Desktop and we are unifying the experience to be the same for Linux distributions as well.All Docker packages will contain buildx by default. The user does not need to install anything else. If a third-party package distributes CLI today without buildx, it may be necessary to update its release pipeline.
Context
There are currently four different ways that one can build locally with Docker:
DOCKER_BUILDKIT=0 docker build .
DOCKER_BUILDKIT=1 docker build .
docker buildx build .
docker buildx create && docker buildx build .
The current state not only confuses users who do not understand the differences between our build experiences, it also contradicts with where we are investing our build engineering effort: in Buildx and BuildKit.
What is buildx?
Buildx is a CLI tool that, combined with the server-side component BuildKit, provides Docker's next generation container build system. Buildx is architected so that it can work with different container runtimes through drivers. Some of the drivers (container and kubernetes) use a containerized version of BuildKit which means that the build tool chain can be updated independently of other container tooling.
Key features of buildx include:
What I did
Forward CLI build command
Docker branded build commands will by default be invoked by buildx client and go to a BuildKit based backend:
docker build
forwarded todocker buildx build
docker image build
forwarded todocker buildx build
docker builder
forwarded todocker buildx
Remove BuildKit implementation
DOCKER_BUILDKIT=0
fallbackDefault behavior for WCOW
Missing plugin
DOCKER_BUILDKIT=1
and plugin is missing or broken, cmd will fail:$ DOCKER_BUILDKIT=1 docker build . ERROR: BuildKit is enabled but the buildx component is missing or broken. Install the buildx component to build images with BuildKit: https://docs.docker.com/go/buildx/
Documentation
Update documentation:
How to verify it
$ docker buildx bake binary $ ./build/docker build .
cc @tonistiigi @thaJeztah @justincormack @mikeparker @chris-crone
closes #3237
Signed-off-by: CrazyMax [email protected]