2015-12-03 14:54:31 -05:00
|
|
|
package lib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ImageHistory returns the changes in an image in history format.
|
|
|
|
func (cli *Client) ImageHistory(imageID string) ([]types.ImageHistory, error) {
|
|
|
|
var history []types.ImageHistory
|
2015-12-05 20:28:36 -05:00
|
|
|
serverResp, err := cli.get("/images/"+imageID+"/history", url.Values{}, nil)
|
2015-12-03 14:54:31 -05:00
|
|
|
if err != nil {
|
|
|
|
return history, err
|
|
|
|
}
|
2015-12-04 14:57:22 -05:00
|
|
|
defer ensureReaderClosed(serverResp)
|
2015-12-03 14:54:31 -05:00
|
|
|
|
|
|
|
if err := json.NewDecoder(serverResp.body).Decode(&history); err != nil {
|
|
|
|
return history, err
|
|
|
|
}
|
|
|
|
return history, nil
|
|
|
|
}
|