Skip to content

Commit 512b711

Browse files
authored
Update list-all-running-container-images.md
also include initContainers
1 parent bec26dd commit 512b711

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 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={.items[*].spec.containers[*].image}`. This will recursively parse out the
26+
using `-o jsonpath={.items[*].spec['initContainers', '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="{.items[*].spec.containers[*].image}" |\
36+
kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec['initContainers', 'containers'][*].image}" |\
3737
tr -s '[[:space:]]' '\n' |\
3838
sort |\
3939
uniq -c
@@ -42,7 +42,7 @@ The jsonpath is interpreted as follows:
4242

4343
- `.items[*]`: for each returned value
4444
- `.spec`: get the spec
45-
- `.containers[*]`: for each container
45+
- `['initContainers', 'containers'][*]`: for each container
4646
- `.image`: get the image
4747

4848
{{< note >}}

0 commit comments

Comments
 (0)