-
Notifications
You must be signed in to change notification settings - Fork 159
feat: support buildx moby worker in docker 23.0.0 onward to accelerating building process by skipping docker load #1472
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
Conversation
…lding process by skipping docker load Signed-off-by: Kaiyang-Chen <kaiyang-chen@sjtu.edu.cn>
Currently, my implementation is that when initialize envd, it will check the docker version of the user, if it's 23.0.0 onward, the default builder will be moby-worker instead of docker-container, so bootstrap step is needed no more. If such mechanism are reasonable, maybe we should change the doc accordingly. |
Please fix the lint problem and include the time comparison! Glad to see this feature! |
Signed-off-by: Kaiyang-Chen <kaiyang-chen@sjtu.edu.cn>
Signed-off-by: Kaiyang Chen <kaiyang-chen@sjtu.edu.cn>
The saving time really depends on the size of the building product, but generally, it just don't need the original execution time for sending tarball / docker load procedure. Here is an running example for docker-container buildkit
moby worker build-in buildkit:
|
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.
Can you also show me what moby worker's context looks like? And please also test to manually create moby context by envd context create
.
Overall looks good to me! Thanks for your contribution!
pkg/version/version.go
Outdated
@@ -138,3 +142,23 @@ func UserAgent() string { | |||
|
|||
return "envd/" + version | |||
} | |||
|
|||
func GetDockerVersion() (int, 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.
Remove blank line here. And I think you can put it within builder package or in utils folder, instead of a new package here
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.
I change it to pkg/driver/docker in order to avoid importing extra package, PTAL
Signed-off-by: Kaiyang Chen <kaiyang-chen@sjtu.edu.cn>
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.
Then will https://github.com/tensorchord/envd/pull/1472/files#diff-1199bd9f65f4618675f464758037bf051b6c122c6ec5ec5350edd6e8159c59e1L261 be executed when moby is used?
And, how do we decide when to use the moby worker?
Yes, but for moby worker, different
Currently, whenever the |
if err != nil { | ||
return nil, errors.Wrap(err, "failed to create buildkit clientt") | ||
} | ||
c.Client = bkcli |
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.
Does this one require bootstrap
?
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.
nope
I'm not sure why we need the |
@kemingy So what you mean is like we need to determine the docker version every time before we build? And change current context accordingly? My understanding was user have the right to choose whatever builder they want, it just if the docker version is high enough, the default builder will be Actually it can have |
I think the |
@kemingy Then we need a new type of builder here, such as "auto builder". Otherwise the builder's address should be deterministic. |
I think it is deterministic. Users cannot have multiple docker engines on the host at the same time. BTW, docker is moby. Adding the |
@kemingy But it's totally different between using envd_buildkit container (docker worker for docker<23.0.0) and using docker's builtin buildx (moby worker for docker >=23.0.0). Thus it's not easy to unify them into the same build type? |
I am not so familiar with every details in envd, so this is just a initial commit. Let me know any part that i should pay attention to when adding a new builder type.
Signed-off-by: Kaiyang-Chen kaiyang-chen@sjtu.edu.cn