github.com/jfrazelle/docker@v1.1.2-0.20210712172922-bf78e25fe508/daemon/images/image_exporter.go (about) 1 package images // import "github.com/docker/docker/daemon/images" 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 (i *ImageService) ExportImage(names []string, outStream io.Writer) error { 15 imageExporter := tarexport.NewTarExporter(i.imageStore, i.layerStore, i.referenceStore, i) 16 return imageExporter.Save(names, outStream) 17 } 18 19 // LoadImage uploads a set of images into the repository. This is the 20 // complement of ExportImage. The input stream is an uncompressed tar 21 // ball containing images and metadata. 22 func (i *ImageService) LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error { 23 imageExporter := tarexport.NewTarExporter(i.imageStore, i.layerStore, i.referenceStore, i) 24 return imageExporter.Load(inTar, outStream, quiet) 25 }