github.com/vvnotw/moby@v1.13.1/client/image_save.go (about)

     1  package client
     2  
     3  import (
     4  	"io"
     5  	"net/url"
     6  
     7  	"golang.org/x/net/context"
     8  )
     9  
    10  // ImageSave retrieves one or more images from the docker host as an io.ReadCloser.
    11  // It's up to the caller to store the images and close the stream.
    12  func (cli *Client) ImageSave(ctx context.Context, imageIDs []string) (io.ReadCloser, error) {
    13  	query := url.Values{
    14  		"names": imageIDs,
    15  	}
    16  
    17  	resp, err := cli.get(ctx, "/images/get", query, nil)
    18  	if err != nil {
    19  		return nil, err
    20  	}
    21  	return resp.body, nil
    22  }