github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/daemon/images/image_exporter.go (about)

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