docs/api/client/lib/container_inspect.go

21 lines
510 B
Go

package lib
import (
"encoding/json"
"github.com/docker/docker/api/types"
)
// ContainerInspect returns the all the container information.
func (cli *Client) ContainerInspect(containerID string) (types.ContainerJSON, error) {
serverResp, err := cli.GET("/containers/"+containerID+"/json", nil, nil)
if err != nil {
return types.ContainerJSON{}, err
}
defer ensureReaderClosed(serverResp)
var response types.ContainerJSON
json.NewDecoder(serverResp.body).Decode(&response)
return response, err
}