github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/engine/client/container_export.go (about) 1 package client // import "github.com/docker/docker/client" 2 3 import ( 4 "context" 5 "io" 6 "net/url" 7 ) 8 9 // ContainerExport retrieves the raw contents of a container 10 // and returns them as an io.ReadCloser. It's up to the caller 11 // to close the stream. 12 func (cli *Client) ContainerExport(ctx context.Context, containerID string) (io.ReadCloser, error) { 13 serverResp, err := cli.get(ctx, "/containers/"+containerID+"/export", url.Values{}, nil) 14 if err != nil { 15 return nil, err 16 } 17 18 return serverResp.body, nil 19 }