Skip to content

Instantly share code, notes, and snippets.

@odewahn
Last active June 12, 2016 22:53
Show Gist options
  • Save odewahn/c283a74d52b5265c2adbbb7340c5d160 to your computer and use it in GitHub Desktop.
Save odewahn/c283a74d52b5265c2adbbb7340c5d160 to your computer and use it in GitHub Desktop.
Example of how to search your own public repos using samalba client
package main
import (
"fmt"
"log"
"github.com/samalba/dockerclient"
)
// Helpful:
// http://stackoverflow.com/questions/24814714/docker-remote-api-pull-from-docker-hub-private-registry
// http://rancher.com/comparing-four-hosted-docker-registries/
func main() {
docker, _ := dockerclient.NewDockerClient("unix:///var/run/docker.sock", nil)
term := "" // leave this blank to get everything, or put in a value if you want to search
results, err := docker.SearchImages(term, "index.docker.io/odewahn", nil)
if err != nil {
log.Fatal(err)
}
for _, c := range results {
fmt.Println(c.Name)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment