func (img *Image) MarshalJSON() ([]byte, error) {
	type MarshalImage Image
	pass1, err := json.Marshal(MarshalImage(*img))
	if err != nil {
		return nil, err
	}
	var c map[string]*json.RawMessage
	if err := json.Unmarshal(pass1, &c); err != nil {
		return nil, err
	}
	return json.Marshal(c)
}
MarshalJSON serializes the image to JSON. It sorts the top-level keys so
that JSON that's been manipulated by a push/pull cycle with a legacy
registry won't end up with a different key order.
package image
import (
	"encoding/json"
	"errors"
	"io"
	"time"
	"github.com/docker/distribution/digest"
	"github.com/docker/docker/api/types/container"
)
type ID digest.Digest
func (id ID) String() string {
	return id.Digest().String()
}
func (id ID) Digest() digest.Digest {
	return digest.Digest(id)
}
func IDFromDigest(digest digest.Digest) ID {
	return ID(digest)
}
type V1Image struct {
	ID string `json:"id,omitempty"`
	Parent string `json:"parent,omitempty"`
	Comment string `json:"comment,omitempty"`
	Created time.Time `json:"created"`
	Container string `json:"container,omitempty"`
	ContainerConfig container.Config `json:"container_config,omitempty"`
	DockerVersion string `json:"docker_version,omitempty"`
	Author string `json:"author,omitempty"`
	Config *container.Config `json:"config,omitempty"`
	Architecture string `json:"architecture,omitempty"`
	OS string `json:"os,omitempty"`
	Size int64 `json:",omitempty"`
}
type Image struct {
	V1Image
	Parent     ID        `json:"parent,omitempty"`
	RootFS     *RootFS   `json:"rootfs,omitempty"`
	History    []History `json:"history,omitempty"`
	OSVersion  string    `json:"os.version,omitempty"`
	OSFeatures []string  `json:"os.features,omitempty"`
	rawJSON []byte
	computedID ID
}
func (img *Image) RawJSON() []byte {
	return img.rawJSON
}
func (img *Image) ID() ID {
	return img.computedID
}
func (img *Image) ImageID() string {
	return img.ID().String()
}
func (img *Image) RunConfig() *container.Config {
	return img.Config
}