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?
Asked
Active
Viewed 1,563 times
1
-
set values into environment var with `--build-arg` – Lawrence Cherone Mar 16 '21 at 21:44
-
@LawrenceCherone that's not possible for my setup – Tri Nguyen Mar 17 '21 at 17:51
2 Answers
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
-
This does not answer my question - I still don't see the image name and tag. – Tri Nguyen Mar 17 '21 at 17:50
-
-
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