Reputation: 4320
I'm trying to get the name of the container image from within the container.
I tried to look around the Downward APIs, but it seems that it's not possible:
https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/
For now my workaround is:
env:
- name: IMAGE
value: "myimage:latest"
Is there maybe a better way?
Upvotes: 5
Views: 2846
Reputation: 9555
Your solution is probably OK, assuming you build your containers with CI/CD. Please see this answer about how to access the kubernetes API from within a cluster as an alternative. Here's the link to POD API docs which should contain the image information.
Upvotes: 1