简体   繁体   中英

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.

How do I check if the Docker image exists in the registry before calling create_namespaced_pod() ? I want to avoid creating the pod and then having to deal with error messages.

you may use docker registry ls to list the contents of your registry and parse for your image specifically. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM