code: func NewChildImage(img *Image, child ChildConfig, os string) *Image {
  	isEmptyLayer := layer.IsEmpty(child.DiffID)
  	var rootFS *RootFS
  	if img.RootFS != nil {
  		rootFS = img.RootFS.Clone()
  	} else {
  		rootFS = NewRootFS()
  	}
  
  	if !isEmptyLayer {
  		rootFS.Append(child.DiffID)
  	}
  	imgHistory := NewHistory(
  		child.Author,
  		child.Comment,
  		strings.Join(child.ContainerConfig.Cmd, " "),
  		isEmptyLayer)
  
  	return &Image{
  		V1Image: V1Image{
  			DockerVersion:   dockerversion.Version,
  			Config:          child.Config,
  			Architecture:    img.BaseImgArch(),
  			OS:              os,
  			Container:       child.ContainerID,
  			ContainerConfig: *child.ContainerConfig,
  			Author:          child.Author,
  			Created:         imgHistory.Created,
  		},
  		RootFS:     rootFS,
  		History:    append(img.History, imgHistory),
  		OSFeatures: img.OSFeatures,
  		OSVersion:  img.OSVersion,
  	}
  }
docs: // NewChildImage creates a new Image as a child of this image.