1

Apologies in advance if this is a bad question, but is it possible to look up the name and tag of the image off of which a container is running, from inside that container?

Tri Nguyen
  • 9,950
  • 8
  • 40
  • 72

2 Answers2

1

As stated by Adrian Antunez, you can run this command to the the container id:

cat /proc/self/cgroup | head -n 1 | cut -d '/' -f3

But it seems you cannot find the image name/tag been used. It seems it's due to security matters.

Saeed
  • 3,255
  • 4
  • 17
  • 36
1

This is not possible currently from (07-2022), and will not be implemented.

You can implement it for example with export IMAGE_NAME=iamawsome-V2.2.3, during build time, so you can use this env in the image.

Martijn van Wezel
  • 1,120
  • 14
  • 25