func (mb *builder) AppendReference(d distribution.Describable) error {
	mb.layers = append(mb.layers, d.Descriptor())
	return nil
}
AppendReference adds a reference to the current ManifestBuilder.
package schema2
import (
	"github.com/docker/distribution"
	"github.com/docker/distribution/context"
	"github.com/docker/distribution/digest"
)
type builder struct {
	bs distribution.BlobService
	configJSON []byte
	layers []distribution.Descriptor
}
func NewManifestBuilder(bs distribution.BlobService, configJSON []byte) distribution.ManifestBuilder {
	mb := &builder{
		bs:         bs,
		configJSON: make([]byte, len(configJSON)),
	}
	copy(mb.configJSON, configJSON)
	return mb
}
func (mb *builder) Build(ctx context.Context) (distribution.Manifest, error) {
	m := Manifest{
		Versioned: SchemaVersion,
		Layers:    make([]distribution.Descriptor, len(mb.layers)),
	}
	copy(m.Layers, mb.layers)
	configDigest := digest.FromBytes(mb.configJSON)
	var err error
	m.Config, err = mb.bs.Stat(ctx, configDigest)
	switch err {
	case nil:
		m.Config.MediaType = MediaTypeConfig
		return FromStruct(m)
	case distribution.ErrBlobUnknown:
	default:
		return nil, err
	}
	m.Config, err = mb.bs.Put(ctx, MediaTypeConfig, mb.configJSON)
	m.Config.MediaType = MediaTypeConfig
	if err != nil {
		return nil, err
	}
	return FromStruct(m)
}