func (imageHandler *DockerImageHandler) CreateImage(imageReqInfo irs.ImageReqInfo) (irs.ImageInfo, error) {
        cblogger.Info("Docker Cloud Driver: called CreateImage()!")
        out, err := imageHandler.Client.ImagePull(imageHandler.Context, imageReqInfo.IId.NameId, types.ImagePullOptions{})
        if err != nil {
                cblogger.Error(err)
                return irs.ImageInfo{}, err
        }
	defer out.Close()
	buf := new(bytes.Buffer)
	buf.ReadFrom(out)
	msg := buf.String()
	repoDigests, err := getRepoDigests(msg)
	if err != nil {
		cblogger.Error(err)
		return irs.ImageInfo{}, err
	}
        images, err := imageHandler.Client.ImageList(imageHandler.Context, types.ImageListOptions{})
        if err != nil {
                cblogger.Error(err)
                return irs.ImageInfo{}, err
        }
        for _, image := range images {
		if strings.Contains(image.RepoDigests[0], repoDigests) {
			imageReqInfo.IId.SystemId = image.ID
			osName, err := getOSInfo(imageHandler, image.ID)
			if err != nil {
				cblogger.Error(err)
				return irs.ImageInfo{}, err
			}
			return irs.ImageInfo{imageReqInfo.IId, osName, "", nil}, nil
		}
        }
	return irs.ImageInfo{}, fmt.Errorf("[Local Repos:" + imageReqInfo.IId.NameId + "] does not exist!")
}
(1) pull from dockerhub
(2) get repo digests id from pulling return
(3) get all image summary from local repos
(4) get image ID and OS Info from inspection
package resources
import (
        "github.com/sirupsen/logrus"
        cblog "github.com/cloud-barista/cb-log"
	"context"
	"github.com/docker/docker/client"
	"github.com/docker/docker/api/types"
	idrv "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces"
	irs "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces/resources"
	"bytes"
	"fmt"
	"strings"
)
type DockerImageHandler struct {
	Region        idrv.RegionInfo
	Context       context.Context
	Client        *client.Client
}
var cblogger *logrus.Logger
func init() {
        cblogger = cblog.GetLogger("CB-SPIDER")
}