github.com/hms58/moby@v1.13.1/daemon/image_exporter.go (about)

     1  package daemon
     2  
     3  import (
     4  	"io"
     5  
     6  	"github.com/docker/docker/image/tarexport"
     7  )
     8  
     9  // ExportImage exports a list of images to the given output stream. The
    10  // exported images are archived into a tar when written to the output
    11  // stream. All images with the given tag and all versions containing
    12  // the same tag are exported. names is the set of tags to export, and
    13  // outStream is the writer which the images are written to.
    14  func (daemon *Daemon) ExportImage(names []string, outStream io.Writer) error {
    15  	imageExporter := tarexport.NewTarExporter(daemon.imageStore, daemon.layerStore, daemon.referenceStore, daemon)
    16  	return imageExporter.Save(names, outStream)
    17  }
    18  
    19  // LoadImage uploads a set of images into the repository. This is the
    20  // complement of ImageExport.  The input stream is an uncompressed tar
    21  // ball containing images and metadata.
    22  func (daemon *Daemon) LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
    23  	imageExporter := tarexport.NewTarExporter(daemon.imageStore, daemon.layerStore, daemon.referenceStore, daemon)
    24  	return imageExporter.Load(inTar, outStream, quiet)
    25  }