github.com/opsramp/moby@v1.13.1/client/image_history.go (about) 1 package client 2 3 import ( 4 "encoding/json" 5 "net/url" 6 7 "github.com/docker/docker/api/types" 8 "golang.org/x/net/context" 9 ) 10 11 // ImageHistory returns the changes in an image in history format. 12 func (cli *Client) ImageHistory(ctx context.Context, imageID string) ([]types.ImageHistory, error) { 13 var history []types.ImageHistory 14 serverResp, err := cli.get(ctx, "/images/"+imageID+"/history", url.Values{}, nil) 15 if err != nil { 16 return history, err 17 } 18 19 err = json.NewDecoder(serverResp.body).Decode(&history) 20 ensureReaderClosed(serverResp) 21 return history, err 22 }