Skip to content
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

Emit a performance warning if containerd is enabled and we're exporting to the daemon #2284

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions pkg/client/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,11 @@
"Re-run with '--pull-policy=always' to silence this warning.")
}

if !opts.Publish && usesContainerdStorage(c.docker) {
c.logger.Warnf("Exporting to docker daemon (building without --publish) and daemon uses containerd storage; performance may be significantly degraded.\n" +
"For more information, see https://github.com/buildpacks/pack/issues/2272.")
}

Check warning on line 310 in pkg/client/build.go

View check run for this annotation

Codecov / codecov/patch

pkg/client/build.go#L308-L310

Added lines #L308 - L310 were not covered by tests

imageRef, err := c.parseReference(opts)
if err != nil {
return errors.Wrapf(err, "invalid image name '%s'", opts.Image)
Expand Down Expand Up @@ -803,6 +808,21 @@
return c.logImageNameAndSha(ctx, opts.Publish, imageRef)
}

func usesContainerdStorage(docker DockerClient) bool {
info, err := docker.Info(context.Background())
if err != nil {
return false
}

for _, driverStatus := range info.DriverStatus {
if driverStatus[0] == "driver-type" && driverStatus[1] == "io.containerd.snapshotter.v1" {
return true
}

Check warning on line 820 in pkg/client/build.go

View check run for this annotation

Codecov / codecov/patch

pkg/client/build.go#L819-L820

Added lines #L819 - L820 were not covered by tests
}

return false
}

func getTargetFromBuilder(builderImage imgutil.Image) (*dist.Target, error) {
builderOS, err := builderImage.OS()
if err != nil {
Expand Down
Loading