Skip to content

Instantly share code, notes, and snippets.

@ikbear
Created September 7, 2015 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikbear/d5c0d64f34da3992150d to your computer and use it in GitHub Desktop.
Save ikbear/d5c0d64f34da3992150d to your computer and use it in GitHub Desktop.
Docker Registry V1 示例
package main
import (
"fmt"
"github.com/CenturyLinkLabs/docker-reg-client/registry"
"net/url"
)
func main() {
c := registry.NewClient()
baseURL, _ := url.Parse("http://192.168.99.100:5000/v1/")
c.BaseURL = baseURL
auth, err := c.Hub.GetReadToken("ubuntu-test")
if err != nil {
panic(err)
}
tags, err := c.Repository.ListTags("ubuntu-test", auth)
if err != nil {
panic(err)
}
id := tags["latest"]
metaData, _ := c.Image.GetMetadata(id, auth)
fmt.Println("Image Size: ", metaData.Size)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment