如何用游牧工作从公共注册表中提取Docker镜像?

时间:2018-12-11 23:31:59

标签: docker nomad

我在GCE上使用nomad,但无法从公共注册表中提取docker映像。

我可以使用pull在命令行中进行docker pull gerlacdt/helloapp:v0.1.0

但是,当尝试使用公共注册表映像运行漫游工作时,出现此错误:

Failed to find docker auth for repo "gerlacdt/helloapp": docker-credential-gcr

相关文件:

/root/.docker/config.json文件:

    {
        "auths": {
                "https://index.docker.io/v1/": {}
        },
        "credHelpers": {
                "asia.gcr.io": "gcr",
                "eu.gcr.io": "gcr",
                "gcr.io": "gcr",
                "staging-k8s.gcr.io": "gcr",
                "us.gcr.io": "gcr"
        }
}

游牧客户端配置:

datacenter = "europe-west1-c"
name       = "consul-clients-092s"
region     = "europe-west1"
bind_addr  = "0.0.0.0"

advertise {
  http = "172.27.3.132"
  rpc  = "172.27.3.132"
  serf = "172.27.3.132"
}

client {
  enabled = true
  options = {
    "docker.auth.config" = "/root/.docker/config.json"
    "docker.auth.helper" = "gcr"
  }
}    
consul {
  address = "127.0.0.1:8500"
}

作业文件:

job "helloapp" {
  datacenters = ["europe-west1-b", "europe-west1-c", "europe-west1-d"]

  constraint {
    attribute = "${attr.kernel.name}"
    value = "linux"
  }

  # Configure the job to do rolling updates
  update {
    stagger = "10s"
    max_parallel = 1
  }

  group "hello" {
    count = 1

    restart {
      attempts = 2
      interval = "1m"
      delay = "10s"
      mode = "fail"
    }

    # Define a task to run
    task "hello" {
      driver = "docker"

      config {
        image = "gerlacdt/helloapp:v0.1.0"
        port_map {
          http = 8080
        }
      }
      service {
        name = "${TASKGROUP}-service"
        tags = [
          # "traefik.tags=public",
          "traefik.frontend.rule=Host:bla.zapto.org",
          "traefik.frontend.entryPoints=http",
          "traefik.tags=exposed"
        ]
        port = "http"
        check {
          name = "alive"
          type = "http"
          interval = "10s"
          timeout = "3s"
          path = "/health"
        }
      }

      resources {
        cpu = 500 # 500 MHz
        memory = 128 # 128MB
        network {
          mbits = 1
          port "http" {
          }
        }
      }

      logs {
        max_files = 10
        max_file_size = 15
      }
      kill_timeout = "10s"
    }
  }
}

来自游牧客户日志的完整错误消息:

failed to initialize task "hello" for alloc "c845bdb9-500a-dc40-0f17-2b79fe4866f1": Failed to find docker auth for repo "gerlacdt/helloapp": docker-credential-gcr with input "gerlacdt/helloapp" failed with stderr:

0 个答案:

没有答案