kubernetes - 使用来自 gcr.io 的图像运行 pod 时出错

标签 kubernetes google-kubernetes-engine google-container-registry

我已经使用以下命令成功地 pushed my Docker container image to gcr.io :
$ gcloud docker push gcr.io/project-id-123456/my-image
但是当我尝试 create a new pod 时,我收到以下错误:

$ kubectl run my-image --image=gcr.io/project-id-123456/my-image
CONTROLLER  CONTAINER(S)  IMAGE(S)                           SELECTOR      REPLICAS
my-image    my-image      gcr.io/project-id-123456/my-image  run=my-image  1

$ kubectl get pods
NAME            READY  STATUS                                                                                                   RESTARTS   AGE
my-image-of9x7  0/1    Error pulling image (latest) from gcr.io/project-id-123456/my-image, Untar exit status 1 unexpected EOF  0          5m

它也不会影响我的本地:
$ docker rmi -f $(docker images -q) # Clear local image cache
$ gcloud docker pull gcr.io/project-id-123456/my-image:latest
…
Error pulling image (latest) from gcr.io/project-id-123456/my-image, Untar re-exec error: exit status 1: output: unexpected EOF

有人可以建议我如何解决这个问题吗?

最佳答案

好的,在 Docker 代码库中挖掘之后,我想我发现了一些关于您所看到的类似报告。

此错误的显示方式在 1.7 中发生了变化,但此线程似乎相关:
https://github.com/docker/docker/issues/14792

这让我想到了这个修复,它在 1.8 中登陆:
https://github.com/docker/docker/pull/15040

特别是,请参阅此评论:
https://github.com/docker/docker/pull/15040#issuecomment-125661037

该评论似乎表明这只是 v1 层的问题,因此我们对 v2 的 Beta 支持可能会解决此问题。

您可以通过以下方式推送到我们的 v2 测试版: gcloud docker --server=beta.gcr.io push beta.gcr.io/project-id-123456/...
然后,您只需将 Pod 中的引用更改为“beta.gcr.io/...”,它将通过 v2 拉取。

关于kubernetes - 使用来自 gcr.io 的图像运行 pod 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32917442/

相关文章:

kubernetes - 探索Azure Kubernetes卷内容

kubernetes - GCP Kubernetes 规模太高

google-container-registry - Google Cloud Builder - 下载依赖项

docker - Dockerfile是否可用于Google Container Registry上的Google示例图像?

kubernetes - 从容器中获取所有k8s pod的IP地址

kubernetes - elasticsearch-curator k8s Helm图表无法连接到HTTPS

kubernetes - Play 应用程序未从Kubernetes yaml文件中选择环境变量

google-cloud-platform - 为特定项目和集群运行单个 kubectl 命令?

google-container-registry - Bitbucket 管道 : pulling an image from GCR with environment variables fails

kubernetes - 谷歌云 Kubernetes : Finding the external IP address for pods