我正在按照本教程设置Kubernetes
https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app
我没有使用教程中的hello项目,而是从自己的Docker存储库下载了映像。这是卡桑德拉的形象
docker pull manuchadha25/codingjedi:3.11.4
图片可用(在Google控制台上选中)
manuchadha25@cloudshell:~ (copper-frame-262317)$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
manuchadha25/cassandra 3.11.4 ca795bbd8fd7 8 months ago 324MB
manuchadha25@cloudshell:~ (copper-frame-262317)$
我现在想将映像推送到Container Registry(我想这是Google自己的注册表,Kubernetes使用它来创建带有所需映像的新节点)。尝试推送图片时出现此错误
manuchadha25@cloudshell:~ (copper-frame-262317)$ docker push gcr.io/${PROJECT_ID}/manuchadha25/cassandra:3.11.4
The push refers to repository [gcr.io/copper-frame-262317/manuchadha25/cassandra]
An image does not exist locally with the tag: gcr.io/copper-frame-262317/manuchadha25/cassandra
manuchadha25@cloudshell:~ (copper-frame-262317)$
我在做什么错了?
答案 0 :(得分:2)
如果要从该GCR加载docker映像,则需要在该GCR中添加该映像的标记版本。
首先阅读以下内容:Docker Tags
下面是问题。如果您只想运行您的泊坞窗映像,则可以这样做。无需将图像推送到GCR。
通过运行docker pull manuchadha25/cassandra:3.11.4
,您可以从
docker hub。只需运行该命令就可以了。如果您确实需要将Docker映像推送到项目的GCR中,则必须告诉Docker GCR所在的位置。
这是通过将图像标记到GCR上完成的。 GCR的标签包含三个不同的部分。
|注册表位置|项目编号|图片名称|
| gcr.io | $ {whateveryouridis} |卡桑德拉|
因此,您可以运行:
docker tag manuchadha25/cassandra:3.11.4 gcr.io/${whateveryouridis}/cassandra:3.11.4
和:
docker push gcr.io/${whateveryouridis}/cassandra:3.11.4
但我对此压力不足
您可以执行此操作,但似乎您只想在GC k8s中运行docker映像。只需尝试docker run manuchadha25/cassandra:3.11.4
。