image_load.go 566 B

12345678910111213141516171819202122
  1. package lib
  2. import (
  3. "io"
  4. "net/url"
  5. "github.com/docker/docker/api/types"
  6. )
  7. // ImageLoad loads an image in the docker host from the client host.
  8. // It's up to the caller to close the io.ReadCloser returned by
  9. // this function.
  10. func (cli *Client) ImageLoad(input io.Reader) (types.ImageLoadResponse, error) {
  11. resp, err := cli.postRaw("/images/load", url.Values{}, input, nil)
  12. if err != nil {
  13. return types.ImageLoadResponse{}, err
  14. }
  15. return types.ImageLoadResponse{
  16. Body: resp.body,
  17. JSON: resp.header.Get("Content-Type") == "application/json",
  18. }, nil
  19. }