github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/client/image_save.go (about)

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