Get the image and SHA image ID of images in pod on Kubernetes deployment
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
To get the container image name and SHA256 image ID of images running in Kubernetes pods, use kubectl get pods -o jsonpath or kubectl describe pod and look at the containerStatuses field. The image field shows the human-readable tag (e.g., nginx:1.25), while imageID shows the full digest (e.g., docker-pullable://nginx@sha256:abc123...). This is essential for verifying exactly which image version is running, since tags are mutable — the same nginx:latest tag can point to different images over time, but the SHA256 digest is immutable.
Quick Commands
Using kubectl describe
JSONPath for Structured Output
Using go-template
Getting Images from Deployments
Init Containers
Scripting with jq
Verifying Image Integrity
Across All Namespaces
Common Pitfalls
- Confusing
spec.containers[].imagewithstatus.containerStatuses[].image: The spec field shows what was requested (may includelatesttag). The status field shows what is actually running, including the resolved tag. TheimageIDin status is the only immutable reference — always use it for verification. - Using mutable tags (
latest,v1) for verification: Tags can be overwritten.nginx:latesttoday may differ fromnginx:latesttomorrow. Always verify using the SHA256 digest fromimageID. For production deployments, pin images by digest:image: nginx@sha256:abc123.... - Empty
containerStatuseson pending pods: If a pod is inPendingstate (image not yet pulled),containerStatusesmay be empty or missing. Checkpod.status.phasefirst, or usestatus.containerStatuses[*]which returns empty rather than erroring. - Multi-container pods showing only the first container:
containerStatuses[0]gets only the first container. For multi-container pods (sidecars, init containers), iterate with{range .status.containerStatuses[*]}or usejqto process all containers. imageIDformat varying by container runtime: Docker usesdocker-pullable://image@sha256:..., containerd usessha256:...directly. Do not hardcode the prefix — parse the SHA256 hash aftersha256:for comparisons.
Summary
- Use
kubectl get pod -o jsonpath='{.status.containerStatuses[*].imageID}'for the immutable SHA256 digest imageshows the tag (mutable),imageIDshows the digest (immutable) — always verify with the digest- Use
custom-columnsorjqfor readable multi-pod output across deployments - Pin production images by digest (
image: app@sha256:...) instead of tags for reproducibility - Check both
containerStatusesandinitContainerStatusesfor pods with init containers
Related reading
- get vs. list in Kubernetes RBAC
- Get YAML for deployed Kubernetes services?
- Getting bad option; for several filesystems e.g. nfs, cifs when trying to mount azure file share in K8 container
- Getting ErrImageNeverPull in pods
- Getting Broker may not be available error when spring boot container tries to connect kafka container
- Getting pika.exceptions.StreamLostError Transport indicated EOF while running python script docker image which using pika
- Get total and free disk space using Prometheus
- Getting Spring Boot color console logging working within Intellij?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.