djangodockerdocker-imagedocker-tag

Displaying docker image tag/version inside Django frontend


I want to display the latest tag of my app's docker image on the frontend of my django application so that the users see the same app version as tagged in the docker image. Any ideas on how to achieve this?


Solution

  • Reading the tag from inside a container is not that straight-forward. But I recommend sending it as a build-arg to the container environment when building the image.

    docker build --build-arg TAG=v0.0.1 .
    

    Also see: Accessing tag as an environment variable inside a Docker container