2018-02-07 15:52:47 -05:00
|
|
|
package images // import "github.com/docker/docker/daemon/images"
|
2016-05-21 16:36:11 -04:00
|
|
|
|
|
|
|
import (
|
2022-07-11 05:46:07 -04:00
|
|
|
"context"
|
2016-05-21 16:36:11 -04:00
|
|
|
"io"
|
|
|
|
|
|
|
|
"github.com/docker/docker/image/tarexport"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ExportImage exports a list of images to the given output stream. The
|
|
|
|
// exported images are archived into a tar when written to the output
|
|
|
|
// stream. All images with the given tag and all versions containing
|
|
|
|
// the same tag are exported. names is the set of tags to export, and
|
|
|
|
// outStream is the writer which the images are written to.
|
2022-07-11 05:46:07 -04:00
|
|
|
func (i *ImageService) ExportImage(ctx context.Context, names []string, outStream io.Writer) error {
|
2021-03-19 10:34:08 -04:00
|
|
|
imageExporter := tarexport.NewTarExporter(i.imageStore, i.layerStore, i.referenceStore, i)
|
2016-05-21 16:36:11 -04:00
|
|
|
return imageExporter.Save(names, outStream)
|
|
|
|
}
|
|
|
|
|
|
|
|
// LoadImage uploads a set of images into the repository. This is the
|
2020-12-25 19:55:24 -05:00
|
|
|
// complement of ExportImage. The input stream is an uncompressed tar
|
2016-05-21 16:36:11 -04:00
|
|
|
// ball containing images and metadata.
|
2022-07-11 05:46:07 -04:00
|
|
|
func (i *ImageService) LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
|
2021-03-19 10:34:08 -04:00
|
|
|
imageExporter := tarexport.NewTarExporter(i.imageStore, i.layerStore, i.referenceStore, i)
|
2016-05-21 16:36:11 -04:00
|
|
|
return imageExporter.Load(inTar, outStream, quiet)
|
|
|
|
}
|