package main import ( "fmt" registry "github.com/dotcloud/docker-registry/client" ) func main() { endpoint := "https://registry.example.com/v2/" client, err := registry.NewClient(endpoint, "", "", nil) if err != nil { // handle error } repos, err := client.Repositories() if err != nil { // handle error } // prints list of repositories found in the registry fmt.Println(repos) }
package main import ( "fmt" registry "github.com/dotcloud/docker-registry/client" ) func main() { endpoint := "https://registry.example.com/v2/" client, err := registry.NewClient(endpoint, "", "", nil) if err != nil { // handle error } tags, err := client.Tags("my-repo") if err != nil { // handle error } // prints list of tags found in the repository fmt.Println(tags) }
package main import ( "fmt" registry "github.com/dotcloud/docker-registry/client" ) func main() { endpoint := "https://registry.example.com/v2/" client, err := registry.NewClient(endpoint, "", "", nil) if err != nil { // handle error } manifest, err := client.Manifest("my-repo", "my-tag") if err != nil { // handle error } // prints the image manifest as a JSON string fmt.Println(string(manifest)) }As can be seen from the code examples, the "github.com.dotcloud.docker.registry Registry" package is used to communicate with Docker's registry API.