Check containerd client before using on Windows

Throw an error if the containerd snapshotter is enabled on Windows but
containerd has not been configured. This fixes a panic in this case when
trying to use an uninitialized client.

Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Derek McGowan
2025-09-04 14:46:26 -07:00
committed by Paweł Gronowski
parent b1dccad684
commit e4a1657762

View File

@@ -1235,6 +1235,9 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
}
if d.imageService == nil {
if d.containerdClient == nil {
return nil, errors.New("containerd snapshotter is enabled but containerd is not configured")
}
log.G(ctx).Info("Starting daemon with containerd snapshotter integration enabled")
resp, err := d.containerdClient.IntrospectionService().Plugins(ctx, `type=="io.containerd.snapshotter.v1"`)