image_exporter.go 1.1 KB

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