Skip to content

Commit 1f7e0c8

Browse files
Emit a performance warning if containerd is enabled and we're exporting to the daemon
Signed-off-by: Natalie Arellano <[email protected]>
1 parent be2c8be commit 1f7e0c8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/client/build.go

+20
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error {
304304
"Re-run with '--pull-policy=always' to silence this warning.")
305305
}
306306

307+
if !opts.Publish && usesContainerdStorage(c.docker) {
308+
c.logger.Warnf("Exporting to docker daemon (building without --publish) and daemon uses containerd storage; performance may be significantly degraded.\n" +
309+
"For more information, see https://github.com/buildpacks/pack/issues/2272.")
310+
}
311+
307312
imageRef, err := c.parseReference(opts)
308313
if err != nil {
309314
return errors.Wrapf(err, "invalid image name '%s'", opts.Image)
@@ -803,6 +808,21 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error {
803808
return c.logImageNameAndSha(ctx, opts.Publish, imageRef)
804809
}
805810

811+
func usesContainerdStorage(docker DockerClient) bool {
812+
info, err := docker.Info(context.Background())
813+
if err != nil {
814+
return false
815+
}
816+
817+
for _, driverStatus := range info.DriverStatus {
818+
if driverStatus[0] == "driver-type" && driverStatus[1] == "io.containerd.snapshotter.v1" {
819+
return true
820+
}
821+
}
822+
823+
return false
824+
}
825+
806826
func getTargetFromBuilder(builderImage imgutil.Image) (*dist.Target, error) {
807827
builderOS, err := builderImage.OS()
808828
if err != nil {

0 commit comments

Comments
 (0)