export.go 424 B

123456789101112131415161718
  1. package lib
  2. import (
  3. "io"
  4. "net/url"
  5. )
  6. // ContainerExport retrieves the raw contents of a container
  7. // and returns them as a io.ReadCloser. It's up to the caller
  8. // to close the stream.
  9. func (cli *Client) ContainerExport(containerID string) (io.ReadCloser, error) {
  10. serverResp, err := cli.get("/containers/"+containerID+"/export", url.Values{}, nil)
  11. if err != nil {
  12. return nil, err
  13. }
  14. return serverResp.body, nil
  15. }