Skip to content

Commit e4550dc

Browse files
committed
Fix: List all unique container images
1 parent fc048b3 commit e4550dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

content/en/docs/tasks/access-application-cluster/list-all-running-container-images.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ of Containers for each.
2323

2424
- Fetch all Pods in all namespaces using `kubectl get pods --all-namespaces`
2525
- Format the output to include only the list of Container image names
26-
using `-o jsonpath={..image}`. This will recursively parse out the
26+
using `-o jsonpath={.items[*].spec.containers[*].image}`. This will recursively parse out the
2727
`image` field from the returned json.
2828
- See the [jsonpath reference](/docs/reference/kubectl/jsonpath/)
2929
for further information on how to use jsonpath.
@@ -33,7 +33,7 @@ of Containers for each.
3333
- Use `uniq` to aggregate image counts
3434

3535
```shell
36-
kubectl get pods --all-namespaces -o jsonpath="{..image}" |\
36+
kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].image}" |\
3737
tr -s '[[:space:]]' '\n' |\
3838
sort |\
3939
uniq -c
@@ -80,7 +80,7 @@ To target only Pods matching a specific label, use the -l flag. The
8080
following matches only Pods with labels matching `app=nginx`.
8181

8282
```shell
83-
kubectl get pods --all-namespaces -o=jsonpath="{..image}" -l app=nginx
83+
kubectl get pods --all-namespaces -o=jsonpath="{.items[*].spec.containers[*].image}" -l app=nginx
8484
```
8585

8686
## List Container images filtering by Pod namespace
@@ -89,7 +89,7 @@ To target only pods in a specific namespace, use the namespace flag. The
8989
following matches only Pods in the `kube-system` namespace.
9090

9191
```shell
92-
kubectl get pods --namespace kube-system -o jsonpath="{..image}"
92+
kubectl get pods --namespace kube-system -o jsonpath="{.items[*].spec.containers[*].image}"
9393
```
9494

9595
## List Container images using a go-template instead of jsonpath

0 commit comments

Comments
 (0)