dtkyayvldeaqhl7151 2015-11-13 15:33
浏览 63

使用go-dockerclient从自定义注册表下载图像挂起

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.

  • 写回答

1条回答 默认 最新

  • douyi8732 2015-11-15 21:35
    关注

    There were networking issues that were preventing the download.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog