Created
September 7, 2015 01:37
-
-
Save ikbear/d5c0d64f34da3992150d to your computer and use it in GitHub Desktop.
Docker Registry V1 示例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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