func childrenHandler(provider content.Provider, platform string) images.HandlerFunc {
	return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
		return children(ctx, provider, desc, platform)
	}
}
childrenHandler decodes well-known manifest types and returns their children.

This is useful for supporting recursive fetch and other use cases where you
want to do a full walk of resources.

One can also replace this with another implementation to allow descending of
arbitrary types.
package image
import (
	"context"
	"encoding/json"
	"net/http"
	"strings"
	"github.com/containerd/containerd"
	"github.com/containerd/containerd/content"
	"github.com/containerd/containerd/errdefs"
	"github.com/containerd/containerd/images"
	"github.com/containerd/containerd/platforms"
	"github.com/containerd/containerd/remotes"
	"github.com/containerd/containerd/remotes/docker"
	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
	"github.com/sirupsen/logrus"
)
func defaultRemoteContext() *containerd.RemoteContext {
	return &containerd.RemoteContext{
		Resolver: docker.NewResolver(docker.ResolverOptions{
			Client: http.DefaultClient,
		}),
		Snapshotter: containerd.DefaultSnapshotter,
	}
}
func PullManifest(ctx context.Context, c *containerd.Client, ref string, opts ...containerd.RemoteOpt) error {
	pullCtx := defaultRemoteContext()
	for _, o := range opts {
		if err := o(c, pullCtx); err != nil {
			return err
		}
	}
	store := c.ContentStore()
	ctx, done, err := c.WithLease(ctx)
	if err != nil {
		return err
	}
	defer done()
	name, desc, err := pullCtx.Resolver.Resolve(ctx, ref)
	if err != nil {
		return err
	}
	fetcher, err := pullCtx.Resolver.Fetcher(ctx, name)
	if err != nil {
		return err
	}
	var (
		schema1Converter *Converter
		handler          images.Handler
	)
	if desc.MediaType == images.MediaTypeDockerSchema1Manifest && pullCtx.ConvertSchema1 {
		schema1Converter = NewConverter(store, fetcher)
		handler = images.Handlers(append(pullCtx.BaseHandlers, schema1Converter)...)
	} else {
		handler = images.Handlers(append(pullCtx.BaseHandlers,
			remotes.FetchHandler(store, fetcher),
			childrenHandler(store, platforms.Default()))...,
		)
	}
	if err := images.Dispatch(ctx, handler, desc); err != nil {
		return err
	}
	if schema1Converter != nil {
		desc, err = schema1Converter.Convert(ctx)
		if err != nil {
			return err
		}
	}
	imgrec := images.Image{
		Name:   name,
		Target: desc,
		Labels: pullCtx.Labels,
	}
	is := c.ImageService()
	if _, err := is.Create(ctx, imgrec); err != nil {
		if !errdefs.IsAlreadyExists(err) {
			return err
		}
		_, err := is.Update(ctx, imgrec)
		if err != nil {
			return err
		}
	}
	return nil
}