本文整理匯總了Golang中github.com/dogestry/dogestry/remote.Remote.ImageMetadata方法的典型用法代碼示例。如果您正苦於以下問題:Golang Remote.ImageMetadata方法的具體用法?Golang Remote.ImageMetadata怎麽用?Golang Remote.ImageMetadata使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/dogestry/dogestry/remote.Remote
的用法示例。
在下文中一共展示了Remote.ImageMetadata方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: exportToFiles
func (cli *DogestryCli) exportToFiles(image string, r remote.Remote, imageRoot string) error {
imageHistory, err := cli.Client.ImageHistory(image)
if err != nil {
fmt.Printf("Error getting image history: %v\n", err)
return err
}
fmt.Println("Checking layers on remote")
imageID := remote.ID(imageHistory[0].ID)
repoName, repoTag := remote.NormaliseImageName(image)
// Check the remote to see what layers are missing. Only missing Ids will
// need to be saved to disk when exporting the docker image.
missingIds := make(set)
for _, i := range imageHistory {
id := remote.ID(i.ID)
_, err = r.ImageMetadata(id)
if err == nil {
fmt.Printf(" exists : %v\n", id)
} else {
fmt.Printf(" not found: %v\n", id)
missingIds[id] = empty
}
}
if len(missingIds) > 0 {
if err := cli.exportImageToFiles(image, imageRoot, missingIds); err != nil {
return err
}
}
if err := cli.exportMetaDataToFiles(repoName, repoTag, imageID, imageRoot); err != nil {
return err
}
return nil
}