简体   繁体   English

如何在调用 kubernetes 的 create_namespaced_pod() 之前以编程方式检查 docker 映像是否存在

[英]How to check programmatically for the existence of a docker image before calling create_namespaced_pod() of kubernetes

I am using create_namespaced_pod() of the kubernetes-client package to dynamically create kubernetes pods from docker images that are in an images registry.我正在使用kubernetes-client package 的create_namespaced_pod()从注册表中的 docker 图像动态创建 kubernetes pod。

How do I check if the Docker image exists in the registry before calling create_namespaced_pod() ?在调用create_namespaced_pod()之前,如何检查注册表中是否存在 Docker 映像? I want to avoid creating the pod and then having to deal with error messages.我想避免创建 pod 然后不得不处理错误消息。

you may use docker registry ls to list the contents of your registry and parse for your image specifically.您可以使用docker registry ls列出注册表的内容并专门解析您的图像。 if ls isn't working for you, you can try a simple HTTP call to the image's URL in the registry, and check the response code.如果ls不适合您,您可以尝试在注册表中对映像的 URL 进行简单的 HTTP 调用,然后检查响应代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在python的kubernetes-client中从AutoscalingV2beta2Api create_namespaced_horizo​​ntal_pod_autoscaler()? - How to create_namespaced_horizontal_pod_autoscaler() from AutoscalingV2beta2Api in kubernetes-client in python? python 应用程序调用 kubernetes 以编程方式创建 pod - python app to call kubernetes to create pod programmatically 在解析之前,如何检查XML中属性和标记的存在? - How can I check the existence of attributes and tags in XML before parsing? 使用 kubernetes 客户端 corev1api 运行 `connect_get_namespaced_pod_exec` 会产生错误的请求 - Running `connect_get_namespaced_pod_exec` using kubernetes client corev1api gives bad request 在容器启动之前在Kubernetes容器中获取数据 - Getting data in Kubernetes pod before the container starts 在 Kubernetes Python 客户端中使用 create_namespaced_secret API - Using create_namespaced_secret API in Kubernetes Python client 使用 kubernetes SDK 为 python 创建一个 pod - Create a pod using kubernetes SDK for python 如何从使用 KubernetesPodOperator 触发它的 Airflow 主机将卷挂载到运行 docker 容器的 Kubernetes Pod - How to mount a volume to a Kubernetes Pod running a docker container from the Airflow host that triggers it using the KubernetesPodOperator 使用 untangle,如何在解析之前检查 XML 中是否存在属性和标签 - Using untangle, how can I check the existence of attributes and tags in XML before parsing 如何使用 python 检查文件是否存在 - How to check file existence with python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM