github.com/walkingsparrow/docker@v1.4.2-0.20151218153551-b708a2249bfa/api/client/lib/export.go (about)

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