I cannot seem to pull from a custom registry. Am I doing it wrong? I know those images exist, I can download them manually.
package main
import (
"github.com/fsouza/go-dockerclient"
log "github.com/Sirupsen/logrus"
)
func main() {
log.SetFormatter(&log.JSONFormatter{})
log.Infoln("pulling remote images.")
pull_images()
log.Infoln("done.")
}
var (
gcr = "gcr.io/google_containers/"
fluentd = docker.PullImageOptions{
Repository: "fluentd-elasticsearch",
Registry: gcr,
RawJSONStream: true,
}
local_images = []docker.PullImageOptions{fluentd,{...}} // there is a long list of image, truncated for example.
)
func pull_images() {
// empty config as it is not needed at this point.
auth := docker.AuthConfiguration{}
client, err := docker.NewClientFromEnv()
if err != nil {
log.Fatal(err)
}
for _, image := range local_images {
log.Infof("pulling %s%s", image.Registry, image.Repository)
err = client.PullImage(image, auth)
if err != nil {
log.Warnln(err)
}
}
}
It works if I specify the docker.io
registry and use the Ubuntu image, but it's not working with the Google one. I can manually pull images with docker pull -a gcr.io/google_containers/fluentd-elasticsearch
, so I know it exists and is actively available. I haven't logged into the Google registry with my docker client, so I know that anonymous pulls are allowed.